Use sha1 to hash an input string.
Parameter
Type
Description
input
string
The input string that we want to be hashed.
outputEncoding
string
Describes what type of encoding we want for the hash value. Can be "base64" or "hex".
Type
Description
string
The string-encoded hash digest
import crypto from "k6/crypto";
export default function() {
let hash = crypto.sha1("hello world!", "hex");
console.log(hash);
}
The above script should result in the following being printed during execution:
Updated 23 days ago