Assets/Scripts/BIP39/RFC2898_PBDF2_HMAC-SHA512.cs
/// <summary>
/// Derive Key Bytes using PBKDF2 specification listed in Rfc2898 and HMACSHA512 as the underlying PRF (Psuedo Random Function)
/// </summary>
/// <param name="keyLength">Length in Bytes of Derived Key</param>
/// <returns>Derived Key</returns>
Derive Key Bytes using PBKDF2 specification listed in Rfc2898 and HMACSHA512 as the underlying PRF (Psuedo Random Function)
Derive Key Bytes using PBKDF2 specification listed in Rfc2898 and HMACSHA512 as the underlying PRF ( Psuedo Random Function )
public Byte[] GetDerivedKeyBytes_PBKDF2_HMACSHA512(Int32 keyLength)
        {
            dkLen = keyLength;
            Double l = Math.Ceiling((Double)dkLen / hLen);
            Byte[] finalBlock = new Byte[0];
            for (Int32 i = 1; i <= l; i++)
            {
                finalBlock = Utilities.MergeByteArrays(finalBlock, F(P, S, c, i));
            }
            return finalBlock.Take(dkLen).ToArray();
        }
public Byte [ ] GetDerivedKeyBytes_PBKDF2_HMACSHA512 ( Int32 keyLength ) { dkLen = keyLength ; Double l = Math . Ceiling ( ( Double ) dkLen / hLen ) ; Byte [ ] finalBlock = new Byte [ 0 ] ; for ( Int32 i = 1 ; i <= l ; i ++ ) { finalBlock = Utilities . MergeByteArrays ( finalBlock , F ( P , S , c , i ) ) ; } return finalBlock . Take ( dkLen ) . ToArray ( ) ; }
Derive Key Bytes using PBKDF2 specification listed in Rfc2898 and HMACSHA512 as the underlying PRF (Psuedo Random Function)
Derive Key Bytes using PBKDF2 specification listed in Rfc2898 and HMACSHA512 as the underlying PRF ( Psuedo Random Function )
//no need to throw exception for dkLen too long as per spec because dkLen cannot be larger than Int32.MaxValue so not worth the overhead to check //Concatenate each block from F into the final block (T_1..T_l) //returning DK note r not used as dkLen bytes of the final concatenated block returned rather than <0...r-1> substring of final intermediate block + prior blocks as per spec
None
keyLength
Int32
Length in Bytes of Derived Key
Length in Bytes of Derived Key