From f604b51d727456183308a3a64e94696309aced5e Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Fri, 21 Nov 2025 21:59:08 +0100 Subject: [PATCH] fix key copy --- cipher.cc | 7 ++----- cipher.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cipher.cc b/cipher.cc index 815b92f..f11cc57 100644 --- a/cipher.cc +++ b/cipher.cc @@ -56,11 +56,8 @@ void cipher::init(const string& phrase) { dig.initDigest(); dig.putDigest( (unsigned char *)phrase.c_str(), phrase.length() ); __key = dig.stringDigest(); // this is a 32 byte long string, as Rijndael:: expects - - /* convert the key to unsigned char[] */ - for(int i=0; i<32; i++) { - key[i] = __key[i]; - } + + memcpy(key, __key, 32); } diff --git a/cipher.h b/cipher.h index e8da86b..b6d5675 100644 --- a/cipher.h +++ b/cipher.h @@ -61,7 +61,6 @@ class cipher { Rijndael rijn; MD5Digest dig; unsigned char key[32]; - string blah; const char* error(int num); public: