SHA-256 cryptographic hash function implementation for TypeScript and JavaScript
91
{
"context": "This evaluation assesses how well the engineer uses @stablelib/sha256's state serialization capability to optimize hash computation for messages with a shared prefix, specifically testing knowledge of saveState(), restoreState(), and cleanSavedState() methods.",
"type": "weighted_checklist",
"checklist": [
{
"name": "SHA256 Instance Creation",
"description": "Creates a SHA256 instance (using 'new SHA256()') to perform hash operations",
"max_score": 10
},
{
"name": "Prefix State Initialization",
"description": "Calls update() method on SHA256 instance with the secret prefix during initialization to establish the base hash state",
"max_score": 15
},
{
"name": "State Serialization Usage",
"description": "Uses saveState() method to capture the hash state after processing the prefix, enabling reuse across multiple messages",
"max_score": 30
},
{
"name": "State Restoration Usage",
"description": "Uses restoreState() method before each message hash to restore the saved prefix state, avoiding recomputation",
"max_score": 30
},
{
"name": "Message Hash Completion",
"description": "Calls update() with message data after state restoration and uses digest() to finalize and return the hash result",
"max_score": 10
},
{
"name": "Secure Cleanup",
"description": "Uses cleanSavedState() to wipe saved state and clean() to wipe hasher instance in the cleanup() method",
"max_score": 5
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-stablelib--sha256docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10