赞
踩
目录
//杂凑算法的测试向量, 如数据杂凑, HMAC等
typedef struct hash_test_vector_st
{
char * inf; //测试向量的附加信息说明
int alg; //杂凑算法
int mod; //模式, 如数据杂凑, HMAC
int klen; //密钥字节长度
char * key; //密钥
int mlen; //消息字节长度
char * msg; //消息
int mdlen; //MAC 字节长度
char * md; //MAC
}HashTV;//杂凑算法的测试向量
HashTV sha1hmactv[] =
{
{/*测试向量0 */
/*inf*/ (char*)"NIST提供HMAC-SHA1 example 1 ", SHA1, HMAC,
/*Key*/ 64, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 20, (char*)"5FD596EE78D5553C 8FF4E72D266DFD19 2366DA29",
},
{/*测试向量1 */
/*inf*/ (char*)"NIST提供HMAC-SHA1 example 2 ", SHA1, HMAC,
/*Key*/ 20, (char*)"0001020304050607 08090A0B0C0D0E0F 10111213",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E",
/*md */ 20, (char*)"4C99FF0CB1B31BD3 3F8431DBAF4D17FC D356A807",
},
{/*测试向量2 */
/*inf*/ (char*)"NIST提供HMAC-SHA1 example 3 ", SHA1, HMAC,
/*Key*/100, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F"
/* */ "4041424344454647 48494A4B4C4D4E4F 5051525354555657 58595A5B5C5D5E5F"
/* */ "60616263",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 20, (char*)"2D51B2F7750E4105 84662E38F133435F 4C4FD42A",
},
{/*测试向量3 */
/*inf*/ (char*)"NIST提供HMAC-SHA1 example 4 ", SHA1, HMAC,
/*Key*/ 49, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 30",
/*msg*/ 54, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E2C2077697468 207472756E636174 656420746167",
/*md */ 12, (char*)"FE3529565CD8E28C 5FA79EAC",
},
};
HashTV sha224hmactv[] =
{
{/*测试向量4 */
/*inf*/ (char*)"NIST提供HMAC-SHA224 example 1 ", SHA224, HMAC,
/*Key*/ 64, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 28, (char*)"C7405E3AE058E8CD 30B08B4140248581 ED174CB34E1224BC C1EFC81B",
},
{/*测试向量5 */
/*inf*/ (char*)"NIST提供HMAC-SHA224 example 2 ", SHA224, HMAC,
/*Key*/ 28, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E",
/*md */ 28, (char*)"E3D249A8CFB67EF8 B7A169E9A0A59971 4A2CECBA65999A51 BEB8FBBE",
},
{/*测试向量6 */
/*inf*/ (char*)"NIST提供HMAC-SHA224 example 3 ", SHA224, HMAC,
/*Key*/100, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F"
/* */ "4041424344454647 48494A4B4C4D4E4F 5051525354555657 58595A5B5C5D5E5F"
/* */ "60616263",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 28, (char*)"91C52509E5AF8531 601AE6230099D90B EF88AAEFB961F408 0ABC014D",
},
{/*测试向量7 */
/*inf*/ (char*)"NIST提供HMAC-SHA224 example 4 ", SHA224, HMAC,
/*Key*/ 49, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 30",
/*msg*/ 54, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E2C2077697468 207472756E636174 656420746167",
/*md */ 16, (char*)"D522F1DF596CA4B4 B1C23D27BDE067D6",
},
};
HashTV sha256hmactv[] =
{
{/*测试向量8 */
/*inf*/ (char*)"NIST提供HMAC-SHA256 example 1 ", SHA256, HMAC,
/*Key*/ 64, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 32, (char*)"8BB9A1DB9806F20D F7F77B82138C7914 D174D59E13DC4D01 69C9057B133E1D62",
},
{/*测试向量9 */
/*inf*/ (char*)"NIST提供HMAC-SHA256 example 2 ", SHA256, HMAC,
/*Key*/ 32, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E",
/*md */ 32, (char*)"A28CF43130EE696A 98F14A37678B56BC FCBDD9E5CF69717F ECF5480F0EBDF790",
},
{/*测试向量10 */
/*inf*/ (char*)"NIST提供HMAC-SHA256 example 3 ", SHA256, HMAC,
/*Key*/100, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F"
/* */ "4041424344454647 48494A4B4C4D4E4F 5051525354555657 58595A5B5C5D5E5F"
/* */ "60616263",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 32, (char*)"BDCCB6C72DDEADB5 00AE768386CB38CC 41C63DBB0878DDB9 C7A38A431B78378D",
},
{/*测试向量11 */
/*inf*/ (char*)"NIST提供HMAC-SHA256 example 4 ", SHA256, HMAC,
/*Key*/ 49, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 30",
/*msg*/ 54, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E2C2077697468 207472756E636174 656420746167",
/*md */ 16, (char*)"27A8B157839EFEAC 98DF070B331D5936",
},
};
HashTV sha384hmactv[] =
{
{/*测试向量12 */
/*inf*/ (char*)"NIST提供HMAC-SHA384 example 1 ", SHA384, HMAC,
/*Key*/128, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F"
/* */ "4041424344454647 48494A4B4C4D4E4F 5051525354555657 58595A5B5C5D5E5F"
/* */ "6061626364656667 68696A6B6C6D6E6F 7071727374757677 78797A7B7C7D7E7F",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 48, (char*)"63C5DAA5E651847C A897C95814AB830B EDEDC7D25E83EEF9 195CD45857A37F44"
/* */ "8947858F5AF50CC2 B1B730DDF29671A9",
},
{/*测试向量13 */
/*inf*/ (char*)"NIST提供HMAC-SHA384 example 2 ", SHA384, HMAC,
/*Key*/ 48, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E",
/*md */ 48, (char*)"6EB242BDBB582CA1 7BEBFA481B1E2321 1464D2B7F8C20B9F F2201637B93646AF"
/* */ "5AE9AC316E98DB45 D9CAE773675EEED0",
},
{/*测试向量14 */
/*inf*/ (char*)"NIST提供HMAC-SHA384 example 3 ", SHA384, HMAC,
/*Key*/200, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F"
/* */ "4041424344454647 48494A4B4C4D4E4F 5051525354555657 58595A5B5C5D5E5F"
/* */ "6061626364656667 68696A6B6C6D6E6F 7071727374757677 78797A7B7C7D7E7F"
/* */ "8081828384858687 88898A8B8C8D8E8F 9091929394959697 98999A9B9C9D9E9F"
/* */ "A0A1A2A3A4A5A6A7 A8A9AAABACADAEAF B0B1B2B3B4B5B6B7 B8B9BABBBCBDBEBF"
/* */ "C0C1C2C3C4C5C6C7",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 48, (char*)"5B664436DF69B0CA 22551231A3F0A3D5 B4F97991713CFA84 BFF4D0792EFF96C2"
/* */ "7DCCBBB6F79B65D5 48B40E8564CEF594",
},
{/*测试向量15 */
/*inf*/ (char*)"NIST提供HMAC-SHA384 example 4 ", SHA384, HMAC,
/*Key*/ 49, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 30",
/*msg*/ 54, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E2C2077697468 207472756E636174 656420746167",
/*md */ 24, (char*)"C48130D3DF703DD7 CDAA56800DFBD2BA 2458320E6E1F98FE",
},
};
HashTV sha512hmactv[] =
{
{/*测试向量16 */
/*inf*/ (char*)"NIST提供HMAC-SHA512 example 1 ", SHA512, HMAC,
/*Key*/128, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F"
/* */ "4041424344454647 48494A4B4C4D4E4F 5051525354555657 58595A5B5C5D5E5F"
/* */ "6061626364656667 68696A6B6C6D6E6F 7071727374757677 78797A7B7C7D7E7F",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 64, (char*)"FC25E240658CA785 B7A811A8D3F7B4CA 48CFA26A8A366BF2 CD1F836B05FCB024"
/* */ "BD36853081811D6C EA4216EBAD79DA1C FCB95EA4586B8A0C E356596A55FB1347",
},
{/*测试向量17 */
/*inf*/ (char*)"NIST提供HMAC-SHA512 example 2 ", SHA512, HMAC,
/*Key*/ 64, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E",
/*md */ 64, (char*)"FD44C18BDA0BB0A6 CE0E82B031BF2818 F6539BD56EC00BDC 10A8A2D730B3634D"
/* */ "E2545D639B0F2CF7 10D0692C72A1896F 1F211C2B922D1A96 C392E07E7EA9FEDC",
},
{/*测试向量18 */
/*inf*/ (char*)"NIST提供HMAC-SHA512 example 3 ", SHA512, HMAC,
/*Key*/200, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 3031323334353637 38393A3B3C3D3E3F"
/* */ "4041424344454647 48494A4B4C4D4E4F 5051525354555657 58595A5B5C5D5E5F"
/* */ "6061626364656667 68696A6B6C6D6E6F 7071727374757677 78797A7B7C7D7E7F"
/* */ "8081828384858687 88898A8B8C8D8E8F 9091929394959697 98999A9B9C9D9E9F"
/* */ "A0A1A2A3A4A5A6A7 A8A9AAABACADAEAF B0B1B2B3B4B5B6B7 B8B9BABBBCBDBEBF"
/* */ "C0C1C2C3C4C5C6C7",
/*msg*/ 34, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3D626C6F636B6C"
/* */ "656E",
/*md */ 64, (char*)"D93EC8D2DE1AD2A9 957CB9B83F14E76A D6B5E0CCE285079A 127D3B14BCCB7AA7"
/* */ "286D4AC0D4CE6421 5F2BC9E6870B33D9 7438BE4AAA20CDA5 C5A912B48B8E27F3",
},
{/*测试向量19 */
/*inf*/ (char*)"NIST提供HMAC-SHA512 example 4 ", SHA512, HMAC,
/*Key*/ 49, (char*)"0001020304050607 08090A0B0C0D0E0F 1011121314151617 18191A1B1C1D1E1F"
/* */ "2021222324252627 28292A2B2C2D2E2F 30",
/*msg*/ 54, (char*)"53616D706C65206D 6573736167652066 6F72206B65796C65 6E3C626C6F636B6C"
/* */ "656E2C2077697468 207472756E636174 656420746167",
/*md */ 32, (char*)"00F3E9A77BB0F06D E15F160603E42B50 28758808596664C0 3E1AB8FB2B076778",
},
};
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。