{"_id":"@bun-win32/bcrypt","_rev":"4-77597d0b1251b2927215a55df6e24456","name":"@bun-win32/bcrypt","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/bcrypt","version":"1.0.0","keywords":["bun","ffi","win32","windows","bcrypt","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/bcrypt@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"f6cf2582dde93830581cd8b3e04fa3ee7a6240d4","tarball":"https://registry.npmjs.org/@bun-win32/bcrypt/-/bcrypt-1.0.0.tgz","fileCount":6,"integrity":"sha512-00IUg8kTXiEt9erFH3nVqLTUdq4nCmOwEPoNNbGQqDBq4AfaIttaWGtc6TTRs5bOq1r/LV4b89LxPwVDTpiWYw==","signatures":[{"sig":"MEQCIDvvVneWUZQCq1XLX87DXQjap5CdgFpm8NrecQieM6GwAiAQ9Id29KONdT94vdOlLxy8JxBa/2AAMSUoDFBOQlUOMQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50709},"main":"./index.ts","type":"module","module":"index.ts","shasum":"f6cf2582dde93830581cd8b3e04fa3ee7a6240d4","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:secret-capsule":"bun ./example/secret-capsule.ts","example:algorithm-inventory":"bun ./example/algorithm-inventory.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-00IUg8kTXiEt9erFH3nVqLTUdq4nCmOwEPoNNbGQqDBq4AfaIttaWGtc6TTRs5bOq1r/LV4b89LxPwVDTpiWYw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/bcrypt"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 BCRYPT bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/bcrypt_1.0.0_1776867964637_0.04364463385432016","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/bcrypt","version":"1.0.1","keywords":["bun","ffi","win32","windows","bcrypt","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/bcrypt@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"368f8449a7969d022fbd4e153b2f4f0c4fef9aaa","tarball":"https://registry.npmjs.org/@bun-win32/bcrypt/-/bcrypt-1.0.1.tgz","fileCount":6,"integrity":"sha512-JzQL6E8rgrCY97rYl6R51s6ao5q6mMrNT9svjBG3bH7wnj3XiBfdmUGf6NkO8M17Xc5gNenyXKQQ+FeG08E02A==","signatures":[{"sig":"MEUCICuj4Un/owjERuAmTKVwBpppXWrcxAnjZrx4le/TRuFVAiEAh3I7H3iKEx7Zzzy5ZS2B4ZnoP3ZrwCLGIMocdtbPFOI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51319},"main":"./index.ts","type":"module","module":"index.ts","shasum":"368f8449a7969d022fbd4e153b2f4f0c4fef9aaa","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:secret-capsule":"bun ./example/secret-capsule.ts","example:algorithm-inventory":"bun ./example/algorithm-inventory.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-JzQL6E8rgrCY97rYl6R51s6ao5q6mMrNT9svjBG3bH7wnj3XiBfdmUGf6NkO8M17Xc5gNenyXKQQ+FeG08E02A==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/bcrypt"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 BCRYPT bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/bcrypt_1.0.1_1781130785265_0.13057902049120362","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/bcrypt","version":"2.0.0","keywords":["bun","ffi","win32","windows","bcrypt","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/bcrypt@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"b299159ac6779cbea5331c71ec7c603d2aee81bc","tarball":"https://registry.npmjs.org/@bun-win32/bcrypt/-/bcrypt-2.0.0.tgz","fileCount":6,"integrity":"sha512-QgyL4/kED+dAPFU5Z4BB47RM17vZT4rDcMHjgXG5+D9C6xDyRTiUcnuslZzxgpMgCxNM+YQ55i4bDsUv8gCYVw==","signatures":[{"sig":"MEUCIQDrCHdhyQTNDXgH37phool7bma1iow3kPFz6MZAJxU7FgIgEfob2rX84HbZ3VKpQrWj5o4nbtXpleo3OeJqUD+/Nzo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":53165},"main":"./index.ts","type":"module","module":"index.ts","shasum":"b299159ac6779cbea5331c71ec7c603d2aee81bc","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:secret-capsule":"bun ./example/secret-capsule.ts","example:algorithm-inventory":"bun ./example/algorithm-inventory.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-QgyL4/kED+dAPFU5Z4BB47RM17vZT4rDcMHjgXG5+D9C6xDyRTiUcnuslZzxgpMgCxNM+YQ55i4bDsUv8gCYVw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/bcrypt"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 BCRYPT bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/bcrypt_2.0.0_1782435269889_0.8520084301948743","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 BCRYPT bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/bcrypt","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/bcrypt"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","bcrypt","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:algorithm-inventory":"bun ./example/algorithm-inventory.ts","example:secret-capsule":"bun ./example/secret-capsule.ts"},"_id":"@bun-win32/bcrypt@2.0.1","_integrity":"sha512-uN915XfJrqSv9K2Xtun5bHSHWe/3OEBmiqckoMhBNlcUU2IGll6IqLHCiKKCIJWwtc+J0pL39Y+aAlso9emU9A==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"514f5ae644b0f11632361a2d1307c8b1fcf7987b","dist":{"integrity":"sha512-uN915XfJrqSv9K2Xtun5bHSHWe/3OEBmiqckoMhBNlcUU2IGll6IqLHCiKKCIJWwtc+J0pL39Y+aAlso9emU9A==","shasum":"514f5ae644b0f11632361a2d1307c8b1fcf7987b","tarball":"https://registry.npmjs.org/@bun-win32/bcrypt/-/bcrypt-2.0.1.tgz","fileCount":6,"unpackedSize":53165,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDLNOnSHttsTstb+TS71SCmkQRgtt9i4Lh4XFFz65xVAwIhALl9lkbu7938ZfXehF4vv5jRg9dtpnjzC1Rt2gtueNSx"}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bcrypt_2.0.1_1782437725099_0.6934523964462622"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-22T14:26:04.520Z","modified":"2026-06-26T01:35:25.341Z","1.0.0":"2026-04-22T14:26:04.788Z","1.0.1":"2026-06-10T22:33:05.415Z","2.0.0":"2026-06-26T00:54:30.100Z","2.0.1":"2026-06-26T01:35:25.228Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","bcrypt","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/bcrypt"},"description":"Zero-dependency, zero-overhead Win32 BCRYPT bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/bcrypt\n\nZero-dependency, zero-overhead Win32 Bcrypt bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/bcrypt` exposes the `bcrypt.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Bcrypt`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `bcrypt.dll` (CNG primitives: ciphers, hashes, HMAC, PBKDF2, signatures, random bytes, and key agreement).\n- In-source docs in `structs/Bcrypt.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Bcrypt.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Bcrypt.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/bcrypt\n```\n\n## Quick Start\n\n```ts\nimport { read } from 'bun:ffi';\n\nimport Bcrypt, { BCRYPT_SHA256_ALG_HANDLE } from '@bun-win32/bcrypt';\n\nBcrypt.Preload(['BCryptCreateHash', 'BCryptDestroyHash', 'BCryptFinishHash', 'BCryptHashData']);\n\nconst message = Buffer.from('hello', 'utf8');\nconst hashHandleBuffer = Buffer.alloc(8);\n\nconst created = Bcrypt.BCryptCreateHash(BCRYPT_SHA256_ALG_HANDLE, hashHandleBuffer.ptr!, null, 0, null, 0, 0);\nif (created < 0) throw new Error(`BCryptCreateHash failed (0x${(created >>> 0).toString(16)})`);\n\nconst hashHandle = BigInt(read.u64(hashHandleBuffer.ptr!, 0));\n\ntry {\n  const hashed = Bcrypt.BCryptHashData(hashHandle, message.ptr!, message.byteLength, 0);\n  if (hashed < 0) throw new Error(`BCryptHashData failed (0x${(hashed >>> 0).toString(16)})`);\n\n  const digest = Buffer.alloc(32);\n  const finished = Bcrypt.BCryptFinishHash(hashHandle, digest.ptr!, digest.byteLength, 0);\n  if (finished < 0) throw new Error(`BCryptFinishHash failed (0x${(finished >>> 0).toString(16)})`);\n\n  console.log(`SHA-256(\"hello\") = ${digest.toString('hex')}`);\n} finally {\n  Bcrypt.BCryptDestroyHash(hashHandle);\n}\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example:algorithm-inventory\nbun run example:secret-capsule\n```\n\n## Notes\n\n- Either rely on lazy binding or call `Bcrypt.Preload()`.\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}