All of them uint256 338/head
authorsvost <ya.nowa@yandex.ru>
Sun, 1 May 2016 17:37:20 +0000 (20:37 +0300)
committersvost <ya.nowa@yandex.ru>
Sun, 1 May 2016 17:37:20 +0000 (20:37 +0300)
src/kernel_worker.cpp
src/key.cpp
src/util.cpp

index 0155361..0091f4b 100644 (file)
@@ -41,13 +41,13 @@ void KernelWorker::Do_generic()
         // Complete first hashing iteration
         uint256 hash1;
         SHA256_Update(&ctx, (unsigned char*)&nTimeTx, 4);
-        SHA256_Final((unsigned char*)&hash1, &ctx);
+        SHA256_Final(hash1.begin(), &ctx);
 
         // Restore context
         ctx = workerCtx;
 
         // Finally, calculate kernel hash
-        SHA256((unsigned char*)&hash1, sizeof(hashProofOfStake), (unsigned char*)&hashProofOfStake);
+        SHA256(hash1.begin(), sizeof(hashProofOfStake), (unsigned char*)&hashProofOfStake);
 
         // Skip if hash doesn't satisfy the maximum target
         if (hashProofOfStake[7] > nMaxTarget32)
@@ -95,14 +95,14 @@ bool ScanKernelBackward(unsigned char *kernel, uint32_t nBits, uint32_t nInputTx
         // Complete first hashing iteration
         uint256 hash1;
         SHA256_Update(&ctx, (unsigned char*)&nTimeTx, 4);
-        SHA256_Final((unsigned char*)&hash1, &ctx);
+        SHA256_Final(hash1.begin(), &ctx);
 
         // Restore context
         ctx = workerCtx;
 
         // Finally, calculate kernel hash
         uint256 hashProofOfStake;
-        SHA256((unsigned char*)&hash1, sizeof(hashProofOfStake), (unsigned char*)&hashProofOfStake);
+        SHA256(hash1.begin(), hashProofOfStake.size(), hashProofOfStake.begin());
 
         // Skip if hash doesn't satisfy the maximum target
         if (hashProofOfStake > nMaxTarget)
index 5319680..e1a6014 100644 (file)
@@ -370,7 +370,7 @@ CPubKey CKey::GetPubKey() const
 bool CKey::Sign(uint256 hash, std::vector<unsigned char>& vchSig)
 {
     vchSig.clear();
-    auto sig = ECDSA_do_sign((unsigned char*)&hash, sizeof(hash), pkey);
+    auto sig = ECDSA_do_sign(hash.begin(), hash.size(), pkey);
     if (sig==NULL)
         return false;
     auto group = EC_KEY_get0_group(pkey);
index 8eba871..744717c 100644 (file)
@@ -185,7 +185,7 @@ int GetRandInt(int nMax)
 uint256 GetRandHash()
 {
     uint256 hash;
-    RAND_bytes((uint8_t*)&hash, sizeof(hash));
+    RAND_bytes(hash.begin(), hash.size());
     return hash;
 }