温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/crypto/scryptSync
点击访问原文链接

Node crypto.scryptSync function | API Reference | Bun

Node crypto.scryptSync function | API Reference | BunBuildDocsReferenceGuidesBlogDiscord/node:crypto/scryptSyncFscryptSync

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:crypto/scryptSyncFscryptSync

function

crypto.scryptSyncfunction scryptSync(password: BinaryLike,salt: BinaryLike,keylen: number,options?: ScryptOptions): NonSharedBuffer;

Provides a synchronous scrypt implementation. Scrypt is a password-based key derivation function that is designed to be expensive computationally and memory-wise in order to make brute-force attacks unrewarding.

The salt should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. See NIST SP 800-132 for details.

When passing strings for password or salt, please consider caveats when using strings as inputs to cryptographic APIs.

An exception is thrown when key derivation fails, otherwise the derived key is returned as a Buffer.

An exception is thrown when any of the input arguments specify invalid values or types.

const {
scryptSync,
} = await import('node:crypto');
// Using the factory defaults.

const key1 = scryptSync('password', 'salt', 64);
console.log(key1.toString('hex')); // '3745e48...08d59ae'
// Using a custom N parameter. Must be a power of two.
const key2 = scryptSync('password', 'salt', 64, { N: 1024 });
console.log(key2.toString('hex')); // '3745e48...aa39b34'
Referenced typestype BinaryLike = string | NodeJS.ArrayBufferViewinterface ScryptOptionsblockSize?: numbercost?: numbermaxmem?: numberN?: numberp?: numberparallelization?: numberr?: number

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

Node crypto.scryptSync function | API Reference | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for function node:crypto.scryptSync | Bun