From: MASM fan Date: Sun, 28 Dec 2014 00:33:22 +0000 (-0800) Subject: Remove remains of experimental scrypt derivation support X-Git-Tag: nvc-v0.5.1~49 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=3eaf7fd0364abb129c282e80b9d095db8fbede52 Remove remains of experimental scrypt derivation support --- diff --git a/src/crypter.cpp b/src/crypter.cpp index e808d06..d6c3bc3 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -8,7 +8,6 @@ #include #include "crypter.h" -#include "scrypt.h" #ifdef WIN32 #include @@ -26,17 +25,6 @@ bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::v (unsigned char *)&strKeyData[0], strKeyData.size(), nRounds, chKey, chIV); } - if (nDerivationMethod == 1) - { - // Passphrase conversion - uint256 scryptHash = scrypt_salted_multiround_hash((const void*)strKeyData.c_str(), strKeyData.size(), &chSalt[0], 8, nRounds); - - i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha512(), &chSalt[0], - (unsigned char *)&scryptHash, sizeof scryptHash, nRounds, chKey, chIV); - OPENSSL_cleanse(&scryptHash, sizeof scryptHash); - } - - if (i != (int)WALLET_CRYPTO_KEY_SIZE) { OPENSSL_cleanse(&chKey, sizeof chKey); diff --git a/src/scrypt.cpp b/src/scrypt.cpp index 3356d22..c0e237d 100644 --- a/src/scrypt.cpp +++ b/src/scrypt.cpp @@ -29,49 +29,8 @@ uint256 scrypt_nosalt(const void* input, size_t inputlen, void *scratchpad) return result; } -uint256 scrypt(const void* data, size_t datalen, const void* salt, size_t saltlen, void *scratchpad) -{ - unsigned int *V; - unsigned int X[32]; - uint256 result = 0; - V = (unsigned int *)(((uintptr_t)(scratchpad) + 63) & ~ (uintptr_t)(63)); - - PBKDF2_SHA256((const uint8_t*)data, datalen, (const uint8_t*)salt, saltlen, 1, (uint8_t *)X, 128); - scrypt_core(X, V); - PBKDF2_SHA256((const uint8_t*)data, datalen, (uint8_t *)X, 128, 1, (uint8_t*)&result, 32); - - return result; -} - -uint256 scrypt_hash(const void* input, size_t inputlen) -{ - unsigned char scratchpad[SCRYPT_BUFFER_SIZE]; - return scrypt_nosalt(input, inputlen, scratchpad); -} - -uint256 scrypt_salted_hash(const void* input, size_t inputlen, const void* salt, size_t saltlen) -{ - unsigned char scratchpad[SCRYPT_BUFFER_SIZE]; - return scrypt(input, inputlen, salt, saltlen, scratchpad); -} - -uint256 scrypt_salted_multiround_hash(const void* input, size_t inputlen, const void* salt, size_t saltlen, const unsigned int nRounds) -{ - uint256 resultHash = scrypt_salted_hash(input, inputlen, salt, saltlen); - uint256 transitionalHash = resultHash; - - for(unsigned int i = 1; i < nRounds; i++) - { - resultHash = scrypt_salted_hash(input, inputlen, (const void*)&transitionalHash, 32); - transitionalHash = resultHash; - } - - return resultHash; -} - uint256 scrypt_blockhash(const void* input) { unsigned char scratchpad[SCRYPT_BUFFER_SIZE]; return scrypt_nosalt(input, 80, scratchpad); } - diff --git a/src/scrypt.h b/src/scrypt.h index 17afd85..b28d090 100644 --- a/src/scrypt.h +++ b/src/scrypt.h @@ -7,9 +7,6 @@ #include "util.h" #include "net.h" -uint256 scrypt_salted_multiround_hash(const void* input, size_t inputlen, const void* salt, size_t saltlen, const unsigned int nRounds); -uint256 scrypt_salted_hash(const void* input, size_t inputlen, const void* salt, size_t saltlen); -uint256 scrypt_hash(const void* input, size_t inputlen); uint256 scrypt_blockhash(const void* input); #endif // SCRYPT_MINE_H