# @harmoniclabs/crypto 中文文档

规范地址：https://npmcn.com/package/%40harmoniclabs/crypto/

版本：0\.3\.1
npm 元数据更新时间：2026-08-05T12:45:54.737Z
中文译文更新时间：2026-11-17T09:57:20.399Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40harmoniclabs/crypto
原文对照：https://npmcn.com/package/%40harmoniclabs/crypto/?lang=original
项目主页：https://github.com/HarmonicLabs/crypto#readme
源码仓库：https://github.com/HarmonicLabs/crypto

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：827 kB，121 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- 运行依赖：2 个
- 首次发布：2023-04-30T15:27:27.113Z
- 最新版本发布：2026-08-05T12:45:54.591Z
- 近 30 天下载量：101716（2026-10-17 至 2026-11-15，npm 官方下载统计）
- 已发布版本数：10（近 12 个月 1 个）

## 中文简介

收集支持ES5+每个js运行时间的加密函数

## 安装

```sh
npm install @harmoniclabs/crypto
```

也可以使用：`pnpm add @harmoniclabs/crypto`、`yarn add @harmoniclabs/crypto`、`bun add @harmoniclabs/crypto`

## README

# @ 谐音板/ crypto

收集支持ES5+每个js运行时间的加密函数

## 免责声明

图书馆的目的是保证支持任何使用ES5+的javascript运行时间.

**这种执行不应被认为安全**

如果您处于节点js环境中,请使用 [节点加密本地模块](https://nodejs.org/api/crypto.html)无疑是更有预想和安全的.

## vrf 批次核查基准

> 注:对于有38个或更多元素的批次,应使用多倍倍增法
> 
> 然而,似乎在执行方面有问题; (b) 盗取者返回错误的地方,然后返回真实的地方(应该如此);
> 
> 现在所有批量的尺寸都使用straus算法,这不是最佳的
> 
> 从基准中可以看出,32码后,时间/防平板 (或比面包更糟)

```
node --version
v22.13.1
```

```
size:    2; time:     36.216ms; time/proof:   18.108ms result: true
size:    4; time:     59.885ms; time/proof:   14.971ms result: true
size:    8; time:    105.061ms; time/proof:   13.133ms result: true
size:   16; time:    217.173ms; time/proof:   13.573ms result: true
size:   32; time:    397.940ms; time/proof:   12.436ms result: true
size:   64; time:    753.830ms; time/proof:   11.779ms result: true
size:  128; time:   1514.647ms; time/proof:   11.833ms result: true
size:  256; time:   3118.631ms; time/proof:   12.182ms result: true
size:  512; time:   6004.233ms; time/proof:   11.727ms result: true
size: 1024; time:  11948.110ms; time/proof:   11.668ms result: true
```

> 注:包子在基本上所有加密功能中都发挥得更好,但这一批活字除外.

```
bun --version
1.1.13
```

```
size:    2; time:     68.439ms; time/proof:   34.219ms result: true
size:    4; time:    130.650ms; time/proof:   32.662ms result: true
size:    8; time:    254.191ms; time/proof:   31.774ms result: true
size:   16; time:    505.512ms; time/proof:   31.594ms result: true
size:   32; time:   1001.648ms; time/proof:   31.301ms result: true
size:   64; time:   1975.420ms; time/proof:   30.866ms result: true
size:  128; time:   4077.155ms; time/proof:   31.853ms result: true
size:  256; time:   9204.953ms; time/proof:   35.957ms result: true
size:  512; time:  18359.952ms; time/proof:   35.859ms result: true
size: 1024; time:  35875.629ms; time/proof:   35.035ms result: true
```

## 常见问题

### @harmoniclabs/crypto 是什么？

收集支持ES5\+每个js运行时间的加密函数

### 如何安装 @harmoniclabs/crypto？

在项目目录运行 npm install @harmoniclabs/crypto，或使用 pnpm add / yarn add / bun add。

### @harmoniclabs/crypto 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @harmoniclabs/crypto 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @harmoniclabs/crypto 可以商用吗？

@harmoniclabs/crypto 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @harmoniclabs/crypto 的下载量有多少？

根据 npm 官方下载统计，@harmoniclabs/crypto 在 2026/10/17 – 2026/11/15 这 30 天内被下载 101,716 次，日均约 3,391 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @harmoniclabs/crypto 还在维护吗？

最新版本 0\.3\.1 发布于 2026/08/05（3 个月前）；至今共发布 10 个版本，其中过去 12 个月发布了 1 个；首次发布于 2023/04/30。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

