Org.BouncyCastle.Crypto.Digests.Sha512tDigest.UInt32_To_BE C# (CSharp) Méthode

UInt32_To_BE() private static méthode

private static UInt32_To_BE ( uint n, byte bs, int off, int max ) : void
n uint
bs byte
off int
max int
Résultat void
        private static void UInt32_To_BE(uint n, byte[] bs, int off, int max)
        {
            int num = System.Math.Min(4, max);
            while (--num >= 0)
            {
                int shift = 8 * (3 - num);
                bs[off + num] = (byte)(n >> shift);
            }
        }
    }

Usage Example

Exemple #1
0
 private static void UInt64_To_BE(ulong n, byte[] bs, int off, int max)
 {
     if (max > 0)
     {
         Sha512tDigest.UInt32_To_BE((uint)(n >> 32), bs, off, max);
         if (max > 4)
         {
             Sha512tDigest.UInt32_To_BE((uint)n, bs, off + 4, max - 4);
         }
     }
 }