deno.land / std@0.166.0 / node / internal / crypto / scrypt_test.ts
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.import { scrypt, scryptSync } from "./scrypt.ts";import { Buffer } from "../../buffer.ts";import { assertEquals } from "../../../testing/asserts.ts";
Deno.test("scrypt works correctly", () => { scrypt("password", "salt", 32, (err, key) => { if (err) throw err; assertEquals( key, Buffer.from([ 116, 87, 49, 175, 68, 132, 243, 35, 150, 137, 105, 237, 162, 137, 174, 238, 0, 91, 89, 3, 172, 86, 30, 100, 165, 172, 161, 33, 121, 123, 247, 115, ]), ); });});
Deno.test("scrypt works with options", () => { scrypt( "password", "salt", 32, { N: 512, }, (err, key) => { if (err) throw err; assertEquals( key, Buffer.from([ 57, 134, 165, 72, 236, 9, 166, 182, 42, 46, 138, 230, 251, 154, 25, 15, 214, 209, 57, 208, 31, 163, 203, 87, 251, 42, 144, 179, 98, 92, 193, 71, ]), ); }, );});
Deno.test("scryptSync works correctly", () => { const key = scryptSync("password", "salt", 32); assertEquals( key, Buffer.from([ 116, 87, 49, 175, 68, 132, 243, 35, 150, 137, 105, 237, 162, 137, 174, 238, 0, 91, 89, 3, 172, 86, 30, 100, 165, 172, 161, 33, 121, 123, 247, 115, ]), );});
Deno.test("scryptSync with options works correctly", () => { const key = scryptSync("password", "salt", 32, { N: 512 }); assertEquals( key, Buffer.from([ 57, 134, 165, 72, 236, 9, 166, 182, 42, 46, 138, 230, 251, 154, 25, 15, 214, 209, 57, 208, 31, 163, 203, 87, 251, 42, 144, 179, 98, 92, 193, 71, ]), );});
Version Info