...
Question Creation API should accept the response from the Question Creator to generate the hash encrypted value of the response created. This responseKey will be persisted along with Question metadata. Since the actual response is hashed encrypted there is no effective mechanism to derive the right answer. Any Subsequent question Read API will only generate responses with hashKey encryptString without actual result.
KeySet (Futuristic):
...
Code Block | ||||
---|---|---|---|---|
| ||||
console.time("dbsave"); var crypto = require('crypto'); var hashListencryptList = []; var string = "sdgxsoksgdaodjqwdhuwdh"; var count = 0; var salt = "salty"; for(var i=0;i<1000000;i++) { var hashencrypt = crypto.pbkdf2('secret'+i, salt, 10, 64, 'sha512', (err, derivedKey) => { if (err) throw err; }); hashListencryptList.push(hashencrypt); if(string === hashencrypt) { count++; } } console.log(count); console.log(hashListencryptList.length); console.timeEnd("dbsave"); |
...
Code Block | ||
---|---|---|
| ||
1000000 hashencrypt generation dbsave: 4011.281ms 100000 hashencrypt generation dbsave: 377.208ms 10000 hashencrypt generation dbsave: 57.326ms |
...