예제 #1
0
        /// <summary>
        /// Computes a Lyra2 hash and returns the resulting hash..
        /// </summary>
        /// <param name="lyra2">The <see cref="Lyra2"/> instance to use.</param>
        /// <param name="kLen">The output buffer length.</param>
        /// <param name="pwd">The password buffer.</param>
        /// <param name="salt">The salt buffer.</param>
        /// <param name="timeCost">The time cost parameter.</param>
        /// <param name="nRows">The number of rows in each block.</param>
        /// <param name="nCols">The number of columns in each block.</param>
        /// <returns>The Lyra2 hash.</returns>
        public static byte[] ComputeBytes(this Lyra2 lyra2, int kLen, byte[] pwd, byte[] salt, ulong timeCost, ulong nRows, ulong nCols)
        {
            var hash = new byte[kLen];

            lyra2.Calculate(hash, pwd, salt, timeCost, nRows, nCols);
            return(hash);
        }
예제 #2
0
        /// <summary>
        /// Computes a Lyra2REv3 hash.
        /// </summary>
        /// <param name="input">The input buffer.</param>
        /// <returns>The computed hash.</returns>
        public static byte[] ComputeHash(byte[] input)
        {
            var output = new Blake256().ComputeBytes(input).GetBytes();

            output = new Lyra2(Lyra2Version.v3).ComputeBytes(32, output, output, 1, 4, 4);
            output = new CubeHash256().ComputeBytes(output).GetBytes();
            output = new Lyra2(Lyra2Version.v3).ComputeBytes(32, output, output, 1, 4, 4);
            output = new BlueMidnightWish256().ComputeBytes(output).GetBytes();
            return(output);
        }
예제 #3
0
        /// <summary>
        /// Computes a Lyra2RE hash.
        /// </summary>
        /// <param name="input">The input buffer.</param>
        /// <returns>The computed hash.</returns>
        public static byte[] ComputeHash(byte[] input)
        {
            var output = new Blake256().ComputeBytes(input).GetBytes();

            output = new Keccak256().ComputeBytes(output).GetBytes();
            output = new Lyra2(Lyra2Version.v1).ComputeBytes(32, output, output, 1, 8, 8);
            output = new Skein256().ComputeBytes(output).GetBytes();
            output = new Groestl256().ComputeBytes(output).GetBytes();
            return(output);
        }
예제 #4
0
        public byte[] ComputeHash(byte[] input)
        {
            // IT HOLDS INT32 - so 4 bytes * 8 = 32 bytes
            UInt64 hashSizeInBytes = 32;

            byte[] hashA;
            byte[] hashB = new byte[hashSizeInBytes];
            var    blake = new Blake256();

            hashA = blake.ComputeBytes(input).GetBytes();
            Lyra2.Lyra2 lyra2 = new Lyra2.Lyra2();
            lyra2.Calculate(hashB, hashA, hashA, 8, 8, 8);

            return(hashB);
        }