fix key copy

This commit is contained in:
2025-11-21 21:59:08 +01:00
parent 22ac094680
commit f604b51d72
2 changed files with 2 additions and 6 deletions

View File

@@ -57,10 +57,7 @@ void cipher::init(const string& phrase) {
dig.putDigest( (unsigned char *)phrase.c_str(), phrase.length() ); dig.putDigest( (unsigned char *)phrase.c_str(), phrase.length() );
__key = dig.stringDigest(); // this is a 32 byte long string, as Rijndael:: expects __key = dig.stringDigest(); // this is a 32 byte long string, as Rijndael:: expects
/* convert the key to unsigned char[] */ memcpy(key, __key, 32);
for(int i=0; i<32; i++) {
key[i] = __key[i];
}
} }

View File

@@ -61,7 +61,6 @@ class cipher {
Rijndael rijn; Rijndael rijn;
MD5Digest dig; MD5Digest dig;
unsigned char key[32]; unsigned char key[32];
string blah;
const char* error(int num); const char* error(int num);
public: public: