AES/CBC encrypt and decrypt

    [C#]
    using System.Security.Cryptography;
    
    	public static string Encrypt(string pt, string key, string iv)
            {
                byte[] keyArray = UTF8Encoding.UTF8.GetBytes(key);
                byte[] ivArray = UTF8Encoding.UTF8.GetBytes(iv);
                byte[] ptArray = UTF8Encoding.UTF8.GetBytes(pt);
    
                RijndaelManaged rDel = new RijndaelManaged();
                rDel.Key = keyArray;
                rDel.IV = ivArray;
                rDel.Mode = CipherMode.CBC;
                rDel.Padding = PaddingMode.ANSIX923;
    
                ICryptoTransform cTransform = rDel.CreateEncryptor();
                byte[] resultArray = cTransform.TransformFinalBlock(ptArray, 0, ptArray.Length);
    
                return Convert.ToBase64String(resultArray, 0, resultArray.Length);
            }
    
            public static string Decrypt(string ct, string key, string iv)
            {
                byte[] keyArray = UTF8Encoding.UTF8.GetBytes(key);
                byte[] ivArray = UTF8Encoding.UTF8.GetBytes(iv);
                byte[] ctArray = Convert.FromBase64String(ct);
    
                RijndaelManaged rDel = new RijndaelManaged();
                rDel.Key = keyArray;
                rDel.IV = ivArray;
                rDel.Mode = CipherMode.CBC;
                rDel.Padding = PaddingMode.ANSIX923;
    
                ICryptoTransform cTransform = rDel.CreateDecryptor();
                byte[] resultArray = cTransform.TransformFinalBlock(ctArray, 0, ctArray.Length);
    
                return UTF8Encoding.UTF8.GetString(resultArray);
            }
            private void button1_Click(object sender, EventArgs e)
            {
                String ct = Encrypt("Test String", "1234567812345678", "1234567812345678");
                MessageBox.Show(ct);
    
                String pt = Decrypt("JkHB3VCmg1de4g8/sWGTQg==", "1234567812345678", "1234567812345678");
                MessageBox.Show(pt);
            }
    
    // Verify the result in CryptographyLab
    {
        // JkHB3VCmg1de4g8/sWGTQg==
        $Encoding(
            "Base64", 
            $BlockCipher(
                "AES", 
                $StringData("1234567812345678", UTF8), 
                $StringData("1234567812345678", UTF8), 
                CBC, 
                ANSIX923, 
                $StringData("Test String", UTF8), 
                $BinaryData(NULL),
                ENCRYPT),
            $StringData("", MBCS));
        
        // Test String
        $BlockCipher(
            "AES", 
            $StringData("1234567812345678", UTF8), 
            $StringData("1234567812345678", UTF8), 
            CBC, 
            ANSIX923, 
            $Decoding(
                "Base64",
                $StringData("JkHB3VCmg1de4g8/sWGTQg==", UTF8),
                $BinaryData(NULL)),
            $StringData("", UTF8),
            DECRYPT);
    }

SHA256 digest in OpenSSL

    [VC++]
    #include "stdAfx.h"
    #include <openssl/sha.h>
    
    #pragma comment(lib, "libeay32.lib")
    #pragma comment(lib, "ssleay32.lib")
    
    int main()
    {
        // CA 97 81 12 CA 1B BD CA FA C2 31 B3 9A 23 DC 4D A7 86 EF F8 14 7C 4E 72 B9 80 77 85 AF EE 48 BB 
        unsigned char output[32];
        SHA256_CTX ctx;
        SHA256_Init(&ctx);
        SHA256_Update(&ctx, "a", 1);
        SHA256_Final(output, &ctx);
        for (int i = 0; i < 32; i++)
            printf("%02x ", output[i]);
        printf("\r\n");
        
        return 0;
    }

    // Verify the result in CryptographyLab
    {
        //CA 97 81 12 CA 1B BD CA FA C2 31 B3 9A 23 DC 4D 
        //A7 86 EF F8 14 7C 4E 72 B9 80 77 85 AF EE 48 BB 
        $BinaryToHexString($Hash("SHA256", $StringData("a", MBCS)), U); 
    }

RSA encrypt and decrypt in OpenSSL

    [VC++]
    #include "stdAfx.h"
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h> // strlen
    #include <openssl/rsa.h>
    
    #pragma comment(lib, "libeay32.lib")
    #pragma comment(lib, "ssleay32.lib")
     
    int main()
    {
        char*  n = "\xa9\xf9\x34\x1e\x6a\xdd\x8c\x5c\x51\x4e\x14\xbd\x30\x60\xfd\x63\x15\xc9\x11\x88\x23\x14\xa0\x5c\x69\x46\xec\xca\xef\xae\x22\xeb\x5b\xfe\x60\x31\xd7\xed\x34\x70\x36\xdd\xfe\x3c\xc2\x83\x45\x55\x6b\x07\x96\xfc\x2b\x2d\x14\xa6\x40\x1e\x1c\x52\x24\xa1\x6b\x22\x59\x66\xbe\x3b\xd5\xf5\xf2\x9c\x67\x9d\xad\xda\x8c\x17\xf7\x10\xdb\x36\xcf\xb7\x3a\x99\x01\xb1\x67\x04\xb1\x4d\x71\xe6\x63\xbd\xad\x52\xa8\x38\x9f\xc7\xc6\x2b\xfc\xec\xa2\x40\x30\x1a\x78\xc8\x92\x9b\x77\xab\xb7\x39\x8b\x71\xf9\xed\x7d\x40\xbb\x42\x3c\x61";
        char*  e = "\x00\x01\x00\x01";
        char*  d = "\x19\xd7\x95\xa0\xfa\x46\x6c\xcc\xac\x5f\xde\xaf\x54\xe7\xaa\x1e\xa2\x75\x4b\x81\x13\x34\x53\x9d\x39\x34\x5b\x54\x0f\x54\xbe\x62\x62\x3e\x2e\x89\xe5\x76\x5e\xfe\xa0\x98\xe7\xca\x7d\x18\x50\x36\x48\x6b\x82\xfd\x1b\xe3\x62\xbc\x54\x0b\x3f\xeb\x0d\x3e\xad\x76\xef\xa0\xb7\x19\xc6\x4a\xba\x37\xc1\x7c\xeb\xf4\x7d\xe6\xf2\xc4\xee\x1c\x66\x4f\xd2\x1e\x98\x0d\xed\x5d\x4f\xad\xf0\x89\xcc\x12\x54\xcc\x46\x3f\xe1\xbd\x3e\x2e\x07\x84\x47\xce\xb6\x35\x02\x77\xc5\x34\x5c\xdb\x90\x8a\xa4\x43\xc7\x5b\xd2\xa4\x92\x4f\xac\xb1";
        char*  p = "\xe9\xd3\xd2\x50\x4c\xdb\x2f\x44\x73\x52\x7c\xb6\x53\x94\x34\x3d\xe6\x82\x78\x68\x85\x1f\x5b\xe3\x29\x89\x3c\xe8\x84\x9a\xc4\x13\x76\xbf\x87\xf5\x1d\x9b\xe4\x7f\x24\xd9\x75\x92\x4b\xe7\x47\x30\x0e\xce\x27\xf1\x63\x98\xd0\xb0\xfb\xa0\x3f\x99\x18\xeb\xb9\x1f";
        char*  q = "\xba\x17\x52\x6b\xa7\x68\xa6\x4c\x73\x9b\xb9\xfe\xa9\x79\x28\x91\xc6\xf0\x0a\x1f\x1d\x84\xe5\x82\x76\x55\x67\x27\xfa\x8f\x3b\x0c\xbf\x4b\x6a\xc4\x96\x7d\xb0\x42\xf2\x87\xbb\xa8\x7e\xe0\x3d\xb3\xdc\x2e\x45\xf7\x70\x58\xc5\x12\x4b\x49\x63\x0d\x8e\xb3\xda\x7f";
        char* dp = "\x25\x0f\x38\x6f\x17\xaf\x49\x8f\x8c\xc3\x8f\x16\x8a\xaa\x9b\x99\x0f\xf6\xaf\xc4\xc9\x0c\x8e\x50\xb3\x9d\x97\xb4\xb6\x87\x9c\xfa\x04\xc1\x18\x78\x45\xe8\x16\x4f\xfc\x74\x26\xc9\x38\x14\x80\xd8\xe2\x0f\xd4\x8e\xd2\x9d\x3e\xbe\x3e\x33\x48\xc1\x28\x0c\xfc\x3b";
        char* dq = "\x84\x32\x9f\x35\xa5\x16\xdd\xd4\xbf\xe8\x28\x08\x76\xa2\x80\xa4\x96\xdb\xdd\x84\xdf\x36\x92\xc8\xcc\x81\xbd\x27\x94\x82\xfd\xe2\xff\x5e\x77\x39\xb2\xe3\x15\x3d\x6a\x07\xec\xd3\x35\x56\xdd\xde\x91\x13\x3a\x57\x1e\xb3\xa1\x44\x6e\xc1\x72\xa1\xa5\xf7\xb4\xc7";
        char* qp = "\xe4\xe2\x14\xff\x98\xbf\x7d\xb0\xdf\x67\xee\xc3\xf2\x8b\x77\x62\xcf\xa3\xc0\x82\xc1\xcd\xa2\x6f\x69\x60\x90\xea\x2f\xe8\x20\x0a\x46\x31\xe5\x53\x91\xed\xf7\x40\x3d\x11\x36\xeb\x88\xde\x1b\xa0\x59\x76\xea\x78\x3d\x5c\x81\xb9\x9b\x16\xe4\xb7\x98\x51\xa4\xf9";
        
        RSA* rsa = RSA_new();
        
        BIGNUM * bnN  = BN_new();
        BIGNUM * bnE  = BN_new();
        BIGNUM * bnD  = BN_new();
        BIGNUM * bnP  = BN_new();
        BIGNUM * bnQ  = BN_new();
        BIGNUM * bnDP = BN_new();
        BIGNUM * bnDQ = BN_new();
        BIGNUM * bnQP = BN_new();
        
        BN_bin2bn((const unsigned char *) n, 128, bnN );
        BN_bin2bn((const unsigned char *) e,   4, bnE );
        BN_bin2bn((const unsigned char *) d, 128, bnD );
        BN_bin2bn((const unsigned char *) p,  64, bnP );
        BN_bin2bn((const unsigned char *) q,  64, bnQ );
        BN_bin2bn((const unsigned char *)dp,  64, bnDP);
        BN_bin2bn((const unsigned char *)dq,  64, bnDQ);
        BN_bin2bn((const unsigned char *)qp,  64, bnQP);
        
        char* sN  = BN_bn2hex(bnN );
        char* sE  = BN_bn2hex(bnE );
        char* sD  = BN_bn2hex(bnD );
        char* sP  = BN_bn2hex(bnP );
        char* sQ  = BN_bn2hex(bnQ );
        char* sDP = BN_bn2hex(bnDP);
        char* sDQ = BN_bn2hex(bnDQ);
        char* sQP = BN_bn2hex(bnQP);
        
        printf("%s\r\n\r\n", sN );
        printf("%s\r\n\r\n", sE );
        printf("%s\r\n\r\n", sD );
        printf("%s\r\n\r\n", sP );
        printf("%s\r\n\r\n", sQ );
        printf("%s\r\n\r\n", sDP);
        printf("%s\r\n\r\n", sDQ);
        printf("%s\r\n\r\n", sQP);
        
        rsa->n    = bnN ;
        rsa->e    = bnE ;
        rsa->d    = bnD ;
        rsa->p    = bnP ;
        rsa->q    = bnQ ;
        rsa->dmp1 = bnDP;
        rsa->dmq1 = bnDQ;
        rsa->iqmp = bnQP;
        
        int r1 = RSA_check_key(rsa);
        
        int size = RSA_size(rsa);
        char* message = "abc";
        char* output = new char[size];
        memset(output, 0, size);
        
        int ret1 = RSA_public_encrypt(
        strlen(message), (unsigned char*)message,
        (unsigned char*)output, rsa, RSA_PKCS1_PADDING);
        
        if (ret1 > 0)
        {
            // output, every time the result is different.
            // 55 3b 7d 1b c5 d0 c5 73 0a 23 2b ca 94 8e 13 b5 00 b1 66 4d f1 e1 82 7b 31 dc da a3 9b d3 64 8a e8 71 59 4c eb 38 89 31 df 08 33 61 e0 2f fa 63 f2 f3 eb e5 5f fc 52 1f 81 f9 1b 57 e3 05 4c db 
            // 03 d5 d3 9b 32 8b 5a 84 92 26 1b 0b c2 1a 2e 24 11 7a 11 c5 00 8f 8b 81 8c a3 d9 fc 97 f7 7c d0 00 4d 9f 56 03 78 72 bd 8e 51 91 38 f6 3a c9 c0 71 13 8e bc 23 45 be 7c a2 3f 8e 59 87 a1 48 f9 
            printf("ct: \r\n");
            for (int i = 0; i < size; i++)
               printf("%02x ", (unsigned char)(output[i]));
            printf("\r\n");
        }
        
        char* output2 = new char[size];
        memset(output2, 0, size);
        
        int ret2 = RSA_private_decrypt(size, (const unsigned char *)output,
        (unsigned char *)output2, rsa, RSA_PKCS1_PADDING);
        
        if (ret2 > 0)
        {
            printf("pt: \r\n");
            output2[ret2] = '\0';
            printf("%s\r\n", output2);
        }
        
        delete[] output;
        delete[] output2;
        
        RSA_free(rsa);
        return 0;
    }
    // Verify the result in CryptographyLab
    {
        $BinaryToHexString(
            $RsaesDecrypt("PKCS1_V15",
                $RsaSetKey(
                    " a9 f9 34 1e 6a dd 8c 5c 51 4e 14 bd 30 60 fd 63 15 c9 11 88 23 14 a0 5c 69 46 ec ca ef ae 22 eb 5b fe 60 31 d7 ed 34 70 36 dd fe 3c c2 83 45 55 6b 07 96 fc 2b 2d 14 a6 40 1e 1c 52 24 a1 6b 22 59 66 be 3b d5 f5 f2 9c 67 9d ad da 8c 17 f7 10 db 36 cf b7 3a 99 01 b1 67 04 b1 4d 71 e6 63 bd ad 52 a8 38 9f c7 c6 2b fc ec a2 40 30 1a 78 c8 92 9b 77 ab b7 39 8b 71 f9 ed 7d 40 bb 42 3c 61",
                    " 00 01 00 01",
                    " 19 d7 95 a0 fa 46 6c cc ac 5f de af 54 e7 aa 1e a2 75 4b 81 13 34 53 9d 39 34 5b 54 0f 54 be 62 62 3e 2e 89 e5 76 5e fe a0 98 e7 ca 7d 18 50 36 48 6b 82 fd 1b e3 62 bc 54 0b 3f eb 0d 3e ad 76 ef a0 b7 19 c6 4a ba 37 c1 7c eb f4 7d e6 f2 c4 ee 1c 66 4f d2 1e 98 0d ed 5d 4f ad f0 89 cc 12 54 cc 46 3f e1 bd 3e 2e 07 84 47 ce b6 35 02 77 c5 34 5c db 90 8a a4 43 c7 5b d2 a4 92 4f ac b1",
                    " e9 d3 d2 50 4c db 2f 44 73 52 7c b6 53 94 34 3d e6 82 78 68 85 1f 5b e3 29 89 3c e8 84 9a c4 13 76 bf 87 f5 1d 9b e4 7f 24 d9 75 92 4b e7 47 30 0e ce 27 f1 63 98 d0 b0 fb a0 3f 99 18 eb b9 1f",
                    " ba 17 52 6b a7 68 a6 4c 73 9b b9 fe a9 79 28 91 c6 f0 0a 1f 1d 84 e5 82 76 55 67 27 fa 8f 3b 0c bf 4b 6a c4 96 7d b0 42 f2 87 bb a8 7e e0 3d b3 dc 2e 45 f7 70 58 c5 12 4b 49 63 0d 8e b3 da 7f",
                    " 25 0f 38 6f 17 af 49 8f 8c c3 8f 16 8a aa 9b 99 0f f6 af c4 c9 0c 8e 50 b3 9d 97 b4 b6 87 9c fa 04 c1 18 78 45 e8 16 4f fc 74 26 c9 38 14 80 d8 e2 0f d4 8e d2 9d 3e be 3e 33 48 c1 28 0c fc 3b",
                    " 84 32 9f 35 a5 16 dd d4 bf e8 28 08 76 a2 80 a4 96 db dd 84 df 36 92 c8 cc 81 bd 27 94 82 fd e2 ff 5e 77 39 b2 e3 15 3d 6a 07 ec d3 35 56 dd de 91 13 3a 57 1e b3 a1 44 6e c1 72 a1 a5 f7 b4 c7",
                    " e4 e2 14 ff 98 bf 7d b0 df 67 ee c3 f2 8b 77 62 cf a3 c0 82 c1 cd a2 6f 69 60 90 ea 2f e8 20 0a 46 31 e5 53 91 ed f7 40 3d 11 36 eb 88 de 1b a0 59 76 ea 78 3d 5c 81 b9 9b 16 e4 b7 98 51 a4 f9"
                ),
                $BinaryData(0x
                    55 3b 7d 1b c5 d0 c5 73 0a 23 2b ca 94 8e 13 b5 00 b1 66 4d f1 e1 82 7b 31 dc da a3 9b d3 64 8a e8 71 59 4c eb 38 89 31 df 08 33 61 e0 2f fa 63 f2 f3 eb e5 5f fc 52 1f 81 f9 1b 57 e3 05 4c db 
                    03 d5 d3 9b 32 8b 5a 84 92 26 1b 0b c2 1a 2e 24 11 7a 11 c5 00 8f 8b 81 8c a3 d9 fc 97 f7 7c d0 00 4d 9f 56 03 78 72 bd 8e 51 91 38 f6 3a c9 c0 71 13 8e bc 23 45 be 7c a2 3f 8e 59 87 a1 48 f9 
                    ),
            $BinaryData(NULL)
            )->b, U);
    }

HMAC <SHA3-256> in Crypto++ 8.20

    [VC++]
    #include "stdafx.h"
    #include <hmac.h>
    #include <sha3.h>
    #pragma comment(lib, "cryptlib.lib") // using Crypto++ 8.20
    using namespace CryptoPP;
    
    int _tmain(int argc, _TCHAR* argv[])
    {
       HMAC<SHA3_256> hmac;
    
       int size = hmac.DigestSize();
       byte* output = new byte[size];
    
       hmac.SetKey((byte*)"zhangluduo", 10);
       hmac.Update((byte*)"helloworld", 10);
       hmac.Final(output);
    
       for (int i = 0; i < size; i++)
          printf("%02x ", output[i]);
       printf("\r\n");
    
       delete[] output;
       output = NULL;
    
       return 0;
    }
    
    // Verify the result in CryptographyLab
    {
        //19 89 c0 cc 7e b8 06 f1 fa f3 0e b3 a9 f6 83 0d 
        //5e a2 90 a8 ae fb c8 50 ed 0a 60 47 bb 9d a9 87 
        $BinaryToHexString(
            $HMAC("SHA3-256", 
                $StringData("zhangluduo", MBCS), 
                $StringData("helloworld", MBCS)), 
            L);
    }

PBKDF2 in Crypto++ 8.20

    #include < hmac.h >
    #include < sha.h >
    #include < sha3.h >
    #include < md2.h >
    #include < md4.h >
    #include < md5.h >
    #include < tiger.h >
    #include < whrlpool.h >
    #include < ripemd.h >
    #include < sm3.h >
    #include < pwdbased.h >
    
    #pragma comment(lib, "cryptlib.lib") // using Crypto++ 8.20
    using namespace CryptoPP;
        
    int main()
    {
    	{
    		PKCS5_PBKDF2_HMAC < MD2 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("MD2\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < MD4 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("MD4\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < MD5 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("MD5\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SHA1 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SHA1\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SHA224 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SHA224\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SHA256 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SHA256\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SHA384 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SHA384\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SHA512 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SHA512\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SHA3_224 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SHA3_224\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SHA3_256 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SHA3_256\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SHA3_384 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SHA3_384\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SHA3_512 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SHA3_512\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < Tiger > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("Tiger\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < Whirlpool > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("Whirlpool\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < RIPEMD128 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("RIPEMD128\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < RIPEMD160 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("RIPEMD160\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < RIPEMD256 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("RIPEMD256\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < RIPEMD320 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("RIPEMD320\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    	{
    		PKCS5_PBKDF2_HMAC < SM3 > pbkdf2;
    		byte output[200];
    		pbkdf2.DeriveKey(output, 200, 0, (byte*)"abc", 3, (byte*)"abc", 3, 100);
    		printf("SM3\r\n");
    		for (int i = 0; i < 200; i++)
    			printf("%02x ", output[i]);
    		printf("\r\n");
    	}
    
    
        return 0;
    }
    
    // MD2
    // 9a 44 d8 3c 56 b4 41 88 a9 98 09 14 84 f3 3b ce 32 2b 40 15 56 ee 51 cf d3 cb 3e a8 ee b0 bc c1 ce fe be 69 7c 2e eb 47 49 75 99 13 cd 17 85 77 f8 65 4b 3b 48 7d 0d d6 1e f7 b3 36 78 0e c8 fa f4 96 5a dc 10 5e 6e 3a ba 3a f4 59 28 a8 48 1d 40 e4 e0 a1 3c bd ef 66 6c c8 30 b3 70 1f ae c2 e6 19 1d 8e 2a 34 d6 c2 b5 ed 1d 2f f9 08 2d 42 f6 2f 54 50 75 a5 ee 53 4a 30 cb 2e 07 74 c6 b2 15 0e 27 67 02 34 32 5e 09 78 f9 3b e2 d3 2d 36 42 d0 e6 59 57 9f 94 1a 78 b3 24 d6 24 f3 c1 4f c2 2a a5 81 d1 b2 f2 15 9f 25 d0 d6 40 c3 3a 4e 92 ce 07 06 0e a4 af 68 12 fc e0 61 92 d3 ce af c8 73 00 0c 8a 86 ad bb 
    // 
    // MD4
    // 9e a2 a9 7a 1d 34 83 5e a2 10 22 00 10 d3 d5 4e 9b 37 51 a8 08 a9 bc 39 7e 94 12 79 34 78 3f 97 b7 d6 a7 de 18 50 54 81 78 ae f4 cd 6d aa 5f c4 2e b8 21 81 9d f2 13 2c 02 5a 7a 9b 8b a2 1d 69 15 85 60 67 75 35 c6 b6 2f 7d aa 58 9d ce f5 3e 79 32 d4 8f d9 d4 7e 66 8b 20 76 b2 de 70 8f 5d 8f 52 51 60 2a 0e 76 c7 9c bf 90 37 97 69 27 d2 a0 64 14 97 0f 44 3d 15 fa d0 30 fa f1 36 93 58 84 2d b9 be 4a 50 43 71 6a 2d 56 f5 18 ad d8 fd 73 be b4 a9 65 a6 3a af 82 58 9d 5f 11 f2 73 e5 69 de 84 59 1d ea 7f 7d 7c 2d 2f a2 c3 53 bd 46 b6 60 ca 82 c7 ad a6 5a 49 c2 e7 e3 dc c1 6c d0 c6 b8 1a 56 4a e8 09 91 
    // 
    // MD5
    // e3 91 c6 b8 b0 9a f7 81 71 d8 d7 52 b6 62 41 c2 89 ba 14 63 fe 19 f1 78 75 4c b4 ff 87 d7 be f9 76 12 ab b7 6c 4d 37 11 e6 ae ec 65 71 72 13 4d 5c 3a 2d d1 e0 00 ba c8 e0 bc e6 71 1a 93 e8 e9 03 ad b6 76 af 27 95 22 3e d0 3a c3 e5 43 ec 68 79 22 38 21 c4 f7 24 ec 15 03 61 4e d0 5d d6 c6 73 29 07 98 94 57 bb 04 d4 3f 75 3c 99 0d 35 5f a9 85 35 8e 45 65 4a 82 98 eb 91 54 3c eb c6 43 35 9d ee d6 c2 95 fe 88 08 e9 d0 b3 57 c5 86 de 25 69 47 89 6d ad f1 c9 39 85 da c7 be c5 84 7e 7f 38 6e 7d 3e b9 6e 74 ea 30 7e e0 26 ce 19 bc 61 f8 51 65 c0 84 1b 83 6f bf 06 81 ab 34 fb 5a 9e 4d 89 e8 07 1a 0d 20 
    // 
    // SHA1
    // 23 14 ce 2e 70 37 94 14 cc b7 98 1b 5a bf a3 a8 39 25 d3 9d 70 22 4e 63 b1 4e 6f 56 29 50 b8 44 24 78 24 a9 68 2a e3 7e ad 22 87 cb f1 79 40 8f 3f 06 8c b5 20 a4 95 0a fd 16 f6 21 bc 2d 9c 12 29 c8 94 ce 57 e5 2a 71 f3 e6 b1 74 fd 8e 6a 1b 9a 88 34 a5 58 cd e1 4e 37 bc 39 bf af 90 67 08 a8 18 62 c5 0d d5 73 d1 c7 a3 6b e4 45 04 95 ae 83 c8 f9 4c 2f 62 4d 38 5c 73 a8 16 2e 97 90 d9 20 f9 78 92 9e de cd 9a 8d 9c de c0 f5 6e 74 38 62 f9 74 1a 3d a9 8f 60 26 0b be 22 70 b9 aa b8 eb 34 5e 3d 40 d2 fb eb a2 3c c3 e9 a2 51 77 0b b0 dd bd 3d 35 c8 fc e0 fd ac ae 38 fa 92 2f 2d 34 66 7e 12 c8 68 63 69 
    // 
    // SHA224
    // b8 ad 4d f3 90 3f c2 32 42 da ec 2e 85 84 7a 1c f6 72 4f c2 c5 a3 ef 21 ee 3f 5f 02 87 61 a9 3f 69 c7 a2 3a 3e c3 f0 cf 5b 27 93 80 fb 8b 5b 1f b9 8d fb 8f 96 9c 6c 43 cb be 83 35 97 ef 16 a2 c2 e9 ee 98 0c 66 dc 4c e1 46 47 99 d5 38 af b3 8e 52 ab 6c ae 93 1c d3 2e 13 0a aa 9e c6 ae fb 2a df e3 af 19 98 19 80 d5 b3 2f 2e f3 7a 17 99 e0 e0 ae 6d af 1d 4a 29 7b 0a 79 70 69 14 d2 86 0a 8b 9a 4d 6e 14 f9 cc 1c 22 25 0e 6c c2 7f fb 7f dd 3a 34 f3 cc dc de 31 a8 2d de 27 d4 7e bf f9 56 a9 15 4b 5c 99 8c 87 1c fe 98 c1 1d 20 06 59 c4 15 e2 44 e8 4c 94 7f e5 32 96 5a ad 8f 3f e3 b8 03 cf 12 41 5e 95 
    // 
    // SHA256
    // 16 17 34 4a 3a 00 b0 7d 60 76 36 46 6f fe 5b e5 d2 f8 5d 84 08 8b 89 a7 1c b6 95 1c 79 3a 38 01 3d 40 30 da 6b 3d 36 27 ae fd 50 46 0d 51 a8 db 57 ab c3 83 2c 97 73 23 0f 46 ea 84 5a 9e 49 c6 7a c5 a4 1c dc 0f 1b 79 68 c7 43 33 2e af cc 98 e8 54 42 4b 2e 23 96 8d 34 b4 31 7b 7a 86 e9 cc ff dd ba 73 e6 39 48 bd 6d 47 f7 b6 18 68 e2 3f ae 0e 1f 3c ed 33 75 f9 81 7c 1a c8 4c d7 1e cb 98 f7 2a c8 c0 c1 ff 4c 26 ac 5b 08 9e 4b 5b 7c 6c 75 96 84 29 26 47 ba c6 fb c1 d7 63 c8 0d d2 d8 0a f9 84 80 39 68 cc 67 1e 67 d8 c7 1b 1c 49 45 b1 dd 3f 2f 15 50 af 15 5b 58 f5 9f 7e 3b 8c 57 c6 98 63 f4 ac 47 cf 
    // 
    // SHA384
    // 0e 40 5e a9 f3 9d 09 7a 12 47 9c c9 66 5b 71 d1 27 0c 25 fb 76 a8 49 99 19 2c 72 53 aa c7 5f b9 ae 4a c1 08 ac f9 a6 2d 81 0a ea 7f 13 ad b3 29 cf 18 af 30 79 58 e8 6c 23 b8 eb 5b b1 b7 31 86 0d 57 e9 7d 56 1a cc 51 00 b7 c7 67 ef 08 92 56 67 0c 6a bd c5 53 2a c2 47 f6 15 c7 96 56 3b f9 a1 b9 d4 ac a3 4c e4 1d a4 7d 2d 1c 01 0a 6f b6 41 a2 1b 80 6d 10 02 e6 99 ed 25 5f c0 0a 82 6f ae b4 48 61 32 3a 55 2a 94 8e 6f 31 e1 f1 ff c2 19 99 5f 60 2f ba 77 b3 5d 26 b3 8c 00 09 3a c1 d2 9c be be 60 76 f1 a0 e4 65 5d 85 26 25 04 bf ec c2 d1 2e a0 9b 69 9d d0 66 77 0d 24 75 a1 a1 3f 3f 25 c0 66 b3 d5 a3 
    // 
    // SHA512
    // 88 af 16 3c 98 1d dd 01 04 b6 e3 9e 74 fe 70 1c dc 19 62 d0 92 a7 88 91 b3 c0 66 a5 3e 4c b6 85 2a 13 bb da 39 07 24 bf 85 0e e8 be a9 b0 e7 a1 3b 45 d9 d2 0d 26 ec 82 d2 28 24 ee 2e 24 52 01 21 58 65 4d f1 6f 4d 52 9c 4d 06 a9 fc b0 70 7c f1 21 9a fe a4 4c 70 92 29 79 36 f3 23 f4 8d 53 1c e5 8e 4c b7 97 70 6d e0 83 fa 91 72 fc c7 61 dc c5 6f af e7 4e fa 2f 59 8a 12 38 92 80 02 0f 15 40 cb 0d 41 6e c2 62 de 99 b3 4f 62 9f f5 1a 07 3e d7 5e c6 b7 fb 8b c0 99 61 05 d9 83 49 97 16 08 a3 b6 83 2a c2 74 49 c8 e1 de b5 08 af 07 d2 9e 72 60 59 35 c1 d7 c2 55 49 39 72 48 9a 82 a1 e3 73 19 9b 01 e4 05 
    // 
    // SHA3_224
    // d7 7a a1 58 9b 2b 97 bc 65 8c 5a df 73 49 bc 4d 8c 28 03 74 68 34 67 d9 4a ae 91 21 bb e8 56 28 eb 3c 96 f8 51 f9 15 7b fa cf b0 43 cf 77 81 27 a1 d1 ff c7 e5 48 e6 83 0b dc ea 1a b1 4a 84 17 df 7b 0d 8e 91 74 c4 b7 6a 9a 45 96 3f 72 37 68 2e fa 66 67 8c e3 a9 93 2d 42 75 5f a5 ae d2 64 f2 7f 3f 7f fc 39 94 60 28 c9 8c 51 c6 7a 93 d3 38 3b 68 bc 16 88 ee b8 78 5b 96 ac 04 ae 9d 5f a9 ee 7e a2 57 47 bb 6d f3 d8 15 57 91 bc e9 a8 17 e1 3f 40 14 a8 70 f3 6e f9 2c bf 61 55 d4 e8 1c 3b c2 d8 8e b4 c6 bd dd cf 61 bb 17 2e 2d 38 8f 7b ea d7 80 f8 e0 4e 97 8c 63 3c df 1e 9a cf 56 93 51 fe a4 d4 0c d7 
    // 
    // SHA3_256
    // 1e f3 0a 5c 6a 79 2b 8a f0 2d 73 9e 4d fb 6b 26 1b fb 47 98 5a 09 e3 f7 da b6 a1 e5 59 c7 f2 48 c3 d5 6f 15 36 b0 61 d0 05 94 6f d5 c6 dd a8 a6 fa bd b9 10 04 5c e2 b7 a7 e7 1d 4f d0 d5 86 b3 d2 13 8e 84 fa c8 bc 0f ec 06 c3 08 f7 0c e1 b7 18 e0 f8 05 84 f7 cf 11 4a 00 b5 e9 70 9a 53 20 90 4f 37 1f dd 1f f6 fc 42 24 42 25 8e c8 f3 a8 f0 eb f0 38 7e b6 de 80 5a 6e da 39 ef 3a 4a ce 8a bd 29 27 2c 04 28 70 9d cc 2c a8 9a 82 aa e3 b5 6c 56 85 3b 8c 55 b9 d0 6b 79 88 29 45 49 80 86 de d5 5f c4 60 fe 5c c6 32 79 74 f5 d2 92 4f 6f e2 50 31 95 3b 6c 8e 24 1b a1 ab fb 4f 45 08 2c 59 b5 8a c4 1a 3c 66 
    // 
    // SHA3_384
    // 04 e0 f4 d5 63 7b 26 0b 9f f3 c9 3e 10 bc 1b fa 1d 24 d1 67 58 41 34 73 f8 0b 14 93 d5 81 bd 38 d7 21 1a 1a 64 4c aa d3 7e dc bb 4a b3 13 a8 10 65 0e 14 34 02 57 98 1e cc a4 35 d6 0a 4f 1a c6 59 db 75 9b 30 82 2e c6 40 e7 8b b9 d0 93 49 0b ac fa bc bf af 60 e2 39 f3 a0 2a 24 31 5f 83 04 8e 2a 6b 59 93 4b 05 cf f5 2f 55 27 35 4b f0 e0 ac 61 01 3d 0f 2e bd 2e 05 57 21 f2 0a 8e 8e 65 1f 6f 14 7c 53 bf 00 78 4c 87 ec 79 c8 97 71 d4 e5 e7 04 fc 42 44 48 a5 49 ed ba 05 f6 8f a3 84 ad ef 30 8c b9 cd ca 04 ea 7c 6a 95 09 c3 02 e3 1c d9 bd 90 d7 ec 2b b0 66 84 e9 5f fb 93 5a 91 eb 86 51 e9 c6 d5 24 04 
    // 
    // SHA3_512
    // c3 2c b1 4c f2 1d 1e bc ab 55 bd 66 eb 7f b6 04 c2 a3 83 ae 4e ff 68 5e b3 e6 4f 5a ae 5d ef 02 77 28 6a 18 8a 27 be f5 17 82 91 7e 7d 56 63 c4 36 f6 fa 45 07 a3 d2 b2 48 74 09 c2 4e ab 10 90 b0 ad e7 e2 ed 91 d0 20 16 6c 40 81 c1 dc 3b f5 01 85 ec 81 ff 57 cf 9e 36 e4 2d a8 75 c7 5b 61 a1 a0 82 da a3 df 26 0b 36 37 f6 e0 b4 05 3a 3d 9d 9b f3 7a 2c 86 b3 de 66 f7 55 3f 87 05 9f 0d 90 fd 07 2e f8 58 22 f8 3c 8d 53 a3 f8 88 d3 bd 46 79 e3 ba 4c 38 72 20 ab ca c7 1e a6 48 94 61 38 e5 a2 df b3 77 ac 82 c3 7f 64 22 72 b1 db 7c 03 be 7b b9 e1 cd ee d6 c3 86 dd af bb c4 5d 50 a7 6b ba 62 49 05 12 5c 
    // 
    // Tiger
    // 00 f3 a0 68 bc 6f 31 15 8c f1 8f cb b7 a2 20 a4 06 93 65 c5 2d aa 9a 39 d7 4d 9d b1 36 41 b9 58 78 6e fd 89 13 fc 89 db 08 77 65 63 57 04 f9 6c db f0 01 64 10 06 2d bf 7a f1 cc 4f d7 d4 d1 a6 22 ab 41 50 b2 d8 53 69 3b d4 f0 22 47 9f d7 cc 28 49 57 a1 89 41 b9 06 85 7d fd c6 5d 11 93 91 91 48 48 eb 7d a6 a7 64 52 d6 f5 ab 71 fe 5a d1 29 2f 25 ff 0f 43 37 d1 14 03 98 8e 88 52 5d 17 a0 da 10 c0 85 d0 55 cd c9 82 02 e0 06 24 85 9f 5b 83 73 f0 c3 cb e5 63 e1 4f a4 1b 8c de 52 7c de 36 6c 6c ab 1f ff e8 80 1a 9c cd 0e 6c 0b 15 b7 38 12 0b a7 e1 99 0e 8e 5b 9d c0 75 6a 95 4a 18 03 5b 45 90 c1 e6 39 
    // 
    // Whirlpool
    // c7 93 61 c3 a1 7f 41 06 51 c3 b1 85 a2 84 34 df 52 9e f1 81 98 17 e3 6e 0a 69 2e 98 fd 55 c6 b7 c5 09 f9 43 35 55 32 2e 32 27 64 43 f1 e4 59 b5 f0 66 25 04 24 9d fa f6 25 e0 64 50 0f d3 c1 02 a2 34 4a 78 47 8d c6 f6 f7 cd 9f bf 42 44 07 63 d5 60 ad 79 92 b7 e3 f5 30 3d c6 46 90 a3 84 b5 64 c3 12 96 24 ae 98 3b 92 fa 6a c9 b7 ae 8f fd 88 fa f4 4b e2 78 b2 ec c1 bb b4 2b e2 c9 df 4d 24 72 30 6f c9 10 f3 16 62 2b 5a bc 53 4a ca a8 3f 46 d7 97 44 50 d1 1c bf 12 cd 47 f8 27 84 9d e4 4f 80 96 08 31 ef 10 6f dc f7 e3 0b d6 3b 0d 40 00 5d 0c 71 8b 83 8a 27 02 44 0b 5d 5d 32 8d 6d 8c e9 63 59 b9 2f 57 
    // 
    // RIPEMD128
    // 4e 54 7c be ef 32 ad 0b 74 ec 4d f1 ef 24 0f c7 d7 4f 09 62 11 62 6c 1d 25 2b 54 1f 0f 8d 48 1a ad f7 5f 2d 91 8f 94 8a 24 c3 fa a9 59 9b 9a 1b 3a 2f 94 ad a9 8f d5 77 2d 3c ad 6b 3c 68 2c f3 f4 01 d3 c2 5b 3e 09 56 2c 9b cb d7 a6 e3 e6 a3 f0 8e f0 27 e2 96 3e 60 ca 23 aa 53 f6 6a 0e 84 72 6e d2 67 c2 1d 7e 99 18 79 ea 47 c6 9d df f7 34 36 b6 f6 54 cc bb 4e de 50 db a9 99 b3 76 32 a7 e8 04 1b bb ff 1b 9d 24 2d 29 29 c7 15 e3 88 db 04 9e 47 e2 ea d1 ea be ce b8 0e db 78 98 91 2a 0c cd 14 08 06 d0 62 70 27 bf 8e 53 ce c4 8f cd 43 b9 27 03 a3 d5 a3 d8 3c 3e a1 7b a6 29 cc f4 0c 24 41 4a 3d e3 75 
    // 
    // RIPEMD160
    // 76 dc ac 6d a8 c5 a1 bd 7e ac 8d 4b a1 77 42 8a 99 6c cd 4c cc 5f 38 08 51 ba f2 18 d4 af c1 35 f7 5c d5 1b 84 f8 14 0f 74 08 71 0d a2 22 ee b4 a8 0f 95 0b 1f bf f1 35 b0 bf 23 43 05 06 97 e7 a1 77 3e e9 e1 46 a1 9e a4 c0 05 ed 21 43 4d db c2 b3 be e6 37 b7 5a ec f7 53 d8 2e 41 51 55 83 b3 9f 35 07 76 62 52 bf 73 c6 d6 ca ea cf 4b 75 b5 06 96 8e 6c 68 8c ea 02 ab 5a 75 43 52 ed 3e 16 43 f4 56 1e 78 ca 53 71 e4 d4 67 82 12 33 a4 0c c2 a5 03 0c 43 0f 49 27 0e 07 ee f6 df 51 da cf 76 5a de d2 d4 58 ee c1 3d ab 73 0f d7 8a ee f6 ca 19 2b a9 a2 71 ca 65 ec ed 2b f5 ff 63 c0 4a b0 45 b9 75 90 70 dc 
    // 
    // RIPEMD256
    // 18 bf a4 1e ef 71 01 7b c6 c2 ea d4 54 7a 83 75 98 26 fc 2b a8 35 c0 f6 71 fd a3 63 ee 14 11 3b 67 fc bb f0 e5 4e 0d a8 9e fc be f9 e2 03 0d 40 29 a4 5a 61 2c 47 8e 4b ff 0f d1 08 cb 1d 40 7a ff 6d 41 27 c0 70 3e bd 34 07 75 11 e0 b3 56 5f 51 12 d6 f2 5a ae d5 f6 69 31 a8 8f 1a 48 79 c6 2c fe f5 a3 5b 29 bb 44 d4 5e b6 44 92 d1 e4 5e cb a3 30 34 1f 13 b1 61 48 85 02 c5 d9 97 d6 3f fb c0 c8 cd b9 9f fc f3 81 84 e5 29 c5 64 96 b9 d9 22 01 00 c1 51 27 9f 59 46 12 b1 17 8b c1 c5 ed 30 18 31 7e 49 84 24 93 ba b3 9e bc 4b a2 81 22 6c e7 c4 cf 2d b2 e3 16 50 25 84 62 11 bc af c9 f0 4a ab 63 07 87 d5 
    //
    // RIPEMD320
    // 39 33 b3 6d 85 b1 e4 9b 18 4b dd 28 25 4c e0 30 71 03 a8 f9 07 10 8d b0 a5 af 86 22 42 a9 ea 83 2d 61 23 b7 48 b3 0f f4 56 f9 90 2e bc 79 88 a8 91 b3 c9 5d 69 c4 c2 b9 e1 b2 aa bc cc 0c 53 87 e0 00 ff 7b fd 1a e3 a5 40 cf 8e 6b 48 34 1d 5c 0d 19 07 7c b8 c4 6d fa 0c 98 c1 81 87 25 65 a3 9b 98 ad 2a fd f9 9d b7 ce 3e 3e 9d c2 44 20 22 1f 07 eb 9c 39 95 a8 cc ce 27 d6 16 fa 88 3d ba fd c4 02 d9 90 59 d6 dd 80 73 ea 45 f8 06 8a de 79 e2 4b 50 49 91 9e f3 0c 45 79 f3 84 f0 71 25 6a b0 33 b7 c6 45 5b d5 f1 55 35 9c 90 b0 1c b4 d1 98 f5 ab 27 9e e7 3f ee c5 8d 08 f8 91 cf c7 06 cd 26 88 4f 50 89 27 
    // 
    // SM3
    // 45 84 1c d0 61 95 34 24 36 c9 e1 e3 68 03 de 40 05 95 41 98 e3 2a 14 bb 67 4e 06 75 d0 31 e4 83 cd e9 ba c4 85 40 f4 51 1a e4 d1 6c c8 86 00 8b e4 c5 2d e2 67 b1 22 ce 81 4a 1c b3 34 5a 8b 30 56 bb 4e 32 32 c9 ba 65 97 15 c2 8e 7e 2a f8 69 1a a9 69 d8 04 41 80 35 76 71 9a 51 36 2b 78 f8 9e b3 41 34 25 29 97 75 1f a8 7d 14 a7 b0 95 79 31 72 89 ea 24 8f b3 4b 0d 63 9d 6f 71 81 4b 49 8a d3 ba 9e ed a4 9e 87 2d 78 ee ad e7 11 53 cc 40 8a 33 34 a4 09 23 d5 e2 1d f2 54 fa 3b 47 7f ac ce b2 29 16 df 4e 62 34 5b 7a 3e e6 24 8f f3 27 e5 95 aa 69 91 e0 fb 23 c6 cd 9d d1 0d 29 1c a7 f3 ae e3 9c 7b 81 cc 

    // Verify the result in CryptographyLab
    {
        $BinaryToHexString($PBKDF2("HMAC-MD2", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        $BinaryToHexString($PBKDF2("HMAC-MD4", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        $BinaryToHexString($PBKDF2("HMAC-MD5", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        
        $BinaryToHexString($PBKDF2("HMAC-SHA1", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        
        $BinaryToHexString($PBKDF2("HMAC-SHA224", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        $BinaryToHexString($PBKDF2("HMAC-SHA256", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        $BinaryToHexString($PBKDF2("HMAC-SHA384", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        $BinaryToHexString($PBKDF2("HMAC-SHA512", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  

        $BinaryToHexString($PBKDF2("HMAC-SHA3-224", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        $BinaryToHexString($PBKDF2("HMAC-SHA3-256", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        $BinaryToHexString($PBKDF2("HMAC-SHA3-384", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        $BinaryToHexString($PBKDF2("HMAC-SHA3-512", $StringData("abc", MBCS), $StringData("abc", MBCS), 100, 200), U);  
        ....

    }

BLAKE2s and BLAKE2b in Crypto++ 8.20

[VC++]
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> // strlen
#include "hmac.h"
#include "blake2.h"
using namespace CryptoPP;

#if defined _WIN64
#pragma comment(lib, "cryptopp820_64bit_vc2013_mtd.lib")
#else
#pragma comment(lib, "cryptopp820_32bit_vc2013_debug_mt.lib")
#endif

int _tmain(int argc, _TCHAR* argv[])
{
	{
		// 69 DC 9A F8 0B 88 E3 00 2A 4C 08 0A B2 FC F8 91 
		// 20 EC 03 D1 4E 68 A3 92 DD CF D0 42 DC 08 DB A1 
		unsigned char tmp[32];
		BLAKE2s hash;
		
		hash.SetKey((unsigned char*)"zhangluduo", 10);
		hash.Update((unsigned char*)"helloworld", 10);
		hash.Final(tmp);

		for (int j = 0; j < 32; j++)
			printf("%02x ", tmp[j]);
		printf("\r\n");	

		// $BinaryToHexString($Hash("blake2s-256", 
		// $StringData("helloworld", MBCS),
		// $StringData("zhangluduo", MBCS)
		// ), U);
	}
	{
		// 39 E1 9D 77 6A 1D 91 FC E4 D7 F0 C7 0D A7 74 F7 
		// F2 06 53 17 19 F7 46 37 E5 F4 6A 2D CE D9 86 F8 
		// BA 2F 9F 2C 4A B0 CD E9 52 8F 9D 9C 0E 3E 7B 92 
		// 25 A2 C0 57 C3 A8 0F E2 A4 79 7F 57 E8 4F 81 4B 

		unsigned char tmp[64];
		BLAKE2b hash;
		
		hash.SetKey((unsigned char*)"zhangluduo", 10);
		hash.Update((unsigned char*)"helloworld", 10);
		hash.Final(tmp);

		for (int j = 0; j < 64; j++)
			printf("%02x ", tmp[j]);
		printf("\r\n");	

		//$BinaryToHexString($Hash("blake2b-512", 
		//$StringData("helloworld", MBCS),
		//$StringData("zhangluduo", MBCS)
		//), U);
	}
	//{
	//	// 16 f8 b8 a8 91 c4 03 86 70 d5 43 d0 38 16 b8 2f 9b a3 57 ab ea 97 d5 2f 8e 2b 09 0e 2e 06 87 c3 
	//	unsigned char tmp[32];
	//	HMAC<BLAKE2s> hmac;
	//	
	//	hmac.SetKey((unsigned char*)"zhangluduo", 10);
	//	hmac.Update((unsigned char*)"helloworld", 10);
	//	hmac.Final(tmp);

	//	for (int j = 0; j < 32; j++)
	//		printf("%02x ", tmp[j]);
	//	printf("\r\n");	
	//}

	// $BinaryToHexString($HMAC("blake2s-256", $StringData("zhangluduo", MBCS), $StringData("helloworld", MBCS)), L);

	//{
	//	//e9 42 bc ce 34 2e 3b c6 94 1f 0e 1d 08 3b 8b e0 1f dc 9c 74 70 0e ac 55 cf 57 1b d6 e1 c6 56 0d 25 2a fe 05 35 b3 d8 81 de 5e ab 9d f5 8d 73 da d8 89 92 41 7e f1 44 6b 2c 04 2e 5a 98 65 35 77 
	//	unsigned char tmp[64];
	//	HMAC<BLAKE2b> hmac;
	//	
	//	hmac.SetKey((unsigned char*)"zhangluduo", 10);
	//	hmac.Update((unsigned char*)"helloworld", 10);
	//	hmac.Final(tmp);

	//	for (int j = 0; j < 64; j++)
	//		printf("%02x ", tmp[j]);
	//	printf("\r\n");
	//}

	// $BinaryToHexString($HMAC("blake2b-512", $StringData("zhangluduo", MBCS), $StringData("helloworld", MBCS)), L);
	return 0;
}

CBC_MAC<   > Crypto++ 8.20


#include "stdafx.h"
#include "cbcmac.h"
#include "aes.h"
#include "des.h"
#include "blowfish.h"
#include "modes.h"

#pragma comment(lib, "cryptopp820_32bit_vc2013_debug_mtd.lib")
using namespace CryptoPP;

unsigned char message[64] = 
{
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, 
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, 
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
};

unsigned char key[32] = 
{
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
};

int _tmain(int argc, _TCHAR* argv[])
{
	int keylen = 8;
	{
	byte digest[8];
	CBC_MAC< Blowfish> d;
	d.SetKey(key, keylen);
	d.CalculateDigest(digest, message, 8);
	for (int i = 0; i < 8; i++)
		printf("%02x ", digest[i]);
	printf("\r\n");
	}
	{
	byte digest[8];
	CBC_MAC< Blowfish> d;
	d.SetKey(key, keylen);
	d.CalculateDigest(digest, message, 16);
	for (int i = 0; i < 8; i++)
		printf("%02x ", digest[i]);
	printf("\r\n");
	}
	{
	byte digest[8];
	CBC_MAC< Blowfish> d;
	d.SetKey(key, keylen);
	d.CalculateDigest(digest, message, 24);
	for (int i = 0; i < 8; i++)
		printf("%02x ", digest[i]);
	printf("\r\n");
	}

	return 0;
}

Copyright © 2019 Zhang Luduo.

All rights reserved.