Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 1.28 KB

hc-256.md

File metadata and controls

51 lines (38 loc) · 1.28 KB
using Arctium.Cryptography.Ciphers.StreamCiphers;
using Arctium.Shared.Helpers.Binary;

namespace DEBUG_ConsoleApplicationForTests
{
    /*
     * Example usage of HC-256 cipher (ESTREAM)
     * 
     */


    class Program
    {
        static void Main()
        {
            // HC-256 Initialization Vector and key must 
            // have 32 bytes.

            var key = new byte[32];
            var iv = new byte[32];

            byte[] dataToEncrypt = new byte[65];
            byte[] encryptedData = new byte[65];

            HC_256 hc256 = new HC_256(key, iv);

            // Invoke encryption
            //
            // For best performance, invoke this method 
            // with large amount of data. Method is not optimized
            // to work with small chunks of data but works fine too

            hc256.Encrypt(dataToEncrypt, 0, 65, encryptedData, 0);

            // Show encrypted data

            BinFormat.HexDump(encryptedData);

            // [OUTPUT, Encryption of empty buffer, all 65 - null bytes after encryption]
            // 8589075B 0DF3F6D8 2FC0C542 5179B6A6
            // 3465F053 F2891F80 8B24744E 18480B72
            // EC2792CD BF4DCFEB 7769BF8D FA14AEE4
            // 7B4C50E8 EAF3A9C8 F506016C 81697E32
            // 3F

        }
    }
}