# cipher-base

> abstract base class for crypto-streams

Latest version **1.0.7** (published 2025-09-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install cipher-base
pnpm add cipher-base
yarn add cipher-base
bun add cipher-base
```

## Health

**Score 53/100 (C)** — status: stable.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2025-09-25 |
| First published | 2015-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/cipher-base) |
| Module format | CommonJS |
| Node | >= 0.10 |
| Dependencies | 3 |
| Unpacked size | 15.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Calvin Metcalf |
| Maintainers | ljharb, dcousens, cwmma |
| Keywords | cipher, stream |

## Links

- npm: https://www.npmjs.com/package/cipher-base
- Repository: https://github.com/crypto-browserify/cipher-base
- Homepage: https://github.com/crypto-browserify/cipher-base#readme
- Issues: https://github.com/crypto-browserify/cipher-base/issues
- npm.io page: https://npm.io/package/cipher-base

## Dependencies (3)

- [inherits](https://npm.io/package/inherits.md) ^2.0.4
- [to-buffer](https://npm.io/package/to-buffer.md) ^1.2.2
- [safe-buffer](https://npm.io/package/safe-buffer.md) ^5.2.1

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2025-09-25
- 1.0.6 — 2024-11-26
- 1.0.5 — 2024-11-17
- 1.0.4 — 2017-07-07
- 1.0.3 — 2016-09-13
- 1.0.2 — 2015-10-23
- 1.0.1 — 2015-09-26
- 1.0.0 — 2015-09-26

## README

cipher-base
===

[![Build Status](https://travis-ci.org/crypto-browserify/cipher-base.svg)](https://travis-ci.org/crypto-browserify/cipher-base)

Abstract base class to inherit from if you want to create streams implementing
the same api as node crypto streams.

Requires you to implement 2 methods `_final` and `_update`. `_update` takes a
buffer and should return a buffer, `_final` takes no arguments and should return
a buffer.


The constructor takes one argument and that is a string which if present switches
it into hash mode, i.e. the object you get from crypto.createHash or
crypto.createSign, this switches the name of the final method to be the string
you passed instead of `final` and returns `this` from update.

---
_Source: https://npm.io/package/cipher-base · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
