MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / pwdbased_test

Function pwdbased_test

extra/yassl/taocrypt/test/test.cpp:1284–1314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1282
1283
1284int pwdbased_test()
1285{
1286 PBKDF2_HMAC<SHA> pb;
1287
1288 byte derived[32];
1289 const byte pwd1[] = "password "; // align
1290 const byte salt[] = { 0x12, 0x34, 0x56, 0x78, 0x78, 0x56, 0x34, 0x12 };
1291
1292 pb.DeriveKey(derived, 8, pwd1, 8, salt, sizeof(salt), 5);
1293
1294 const byte verify1[] = { 0xD1, 0xDA, 0xA7, 0x86, 0x15, 0xF2, 0x87, 0xE6 };
1295
1296 if ( memcmp(derived, verify1, sizeof(verify1)) )
1297 return -101;
1298
1299
1300 const byte pwd2[] = "All n-entities must communicate with other n-entities"
1301 " via n-1 entiteeheehees "; // align
1302
1303 pb.DeriveKey(derived, 24, pwd2, 76, salt, sizeof(salt), 500);
1304
1305 const byte verify2[] = { 0x6A, 0x89, 0x70, 0xBF, 0x68, 0xC9, 0x2C, 0xAE,
1306 0xA8, 0x4A, 0x8D, 0xF2, 0x85, 0x10, 0x85, 0x86,
1307 0x07, 0x12, 0x63, 0x80, 0xCC, 0x47, 0xAB, 0x2D
1308 };
1309
1310 if ( memcmp(derived, verify2, sizeof(verify2)) )
1311 return -102;
1312
1313 return 0;
1314}
1315
1316
1317/*

Callers 1

taocrypt_testFunction · 0.85

Calls 1

DeriveKeyMethod · 0.80

Tested by

no test coverage detected