コード例 #1
0
        /// <summary>
        /// Prepares a <see cref="Poly1305"/> instance using <see cref="ChaCha20"/>
        /// and Counter=0 to generate the corresponding key.
        /// </summary>
        /// <param name="Key">Key</param>
        /// <param name="Nonce">Nonce</param>
        /// <returns>Authenticator</returns>
        public static Poly1305 FromChaCha20(byte[] Key, byte[] Nonce)
        {
            ChaCha20 Cipher = new ChaCha20(Key, 0, Nonce);

            byte[] Key2 = Cipher.GetBytes(32);
            return(new Poly1305(Key2));
        }