X-Git-Url: https://git.novaco.in/?p=NovacoinLibrary.git;a=blobdiff_plain;f=Novacoin%2FScryptHash256.cs;h=4f959267eda5b801097a48e8232c250827128790;hp=cb39dd8db28a10eb0a6527b7baaad0f947d8eb60;hb=1ad33d77c24d57f7ac25e0d6cf5f430464cdb058;hpb=534af8e0f785ed0854becde62732e9fcc0a36fe4 diff --git a/Novacoin/ScryptHash256.cs b/Novacoin/ScryptHash256.cs index cb39dd8..4f95926 100644 --- a/Novacoin/ScryptHash256.cs +++ b/Novacoin/ScryptHash256.cs @@ -45,7 +45,7 @@ namespace Novacoin var V = new uint[(131072 + 63) / sizeof(uint)]; var keyBytes1 = CryptoUtils.PBKDF2_Sha256(128, (byte[])inputBytes, (byte[])inputBytes, 1); - var X = ToUInt32Array(keyBytes1); + var X = Interop.ToUInt32Array(keyBytes1); for (var i = 0; i < 1024; i++) { @@ -65,7 +65,7 @@ namespace Novacoin xor_salsa8(ref X, 16, ref X, 0); } - var xBytes = LEBytes(X); + var xBytes = Interop.LEBytes(X); var keyBytes2 = CryptoUtils.PBKDF2_Sha256(32, (byte[])inputBytes, xBytes, 1); return new ScryptHash256(keyBytes2); @@ -141,32 +141,5 @@ namespace Novacoin B[indexB + 14] += x14; B[indexB + 15] += x15; } - - /// - /// Convert array of unsigned integers to array of bytes. - /// - /// Array of unsigned integer values. - /// Byte array - private static byte[] LEBytes(uint[] values) - { - var result = new byte[values.Length * sizeof(uint)]; - Buffer.BlockCopy(values, 0, result, 0, result.Length); - - return result; - } - - /// - /// Convert byte array to array of unsigned integers. - /// - /// Byte array. - /// Array of integers - private static uint[] ToUInt32Array(byte[] bytes) - { - var result = new uint[bytes.Length / sizeof(uint)]; - Buffer.BlockCopy(bytes, 0, result, 0, bytes.Length); - - return result; - } - } }