# cryptomancy-shard

> really basic secret sharing based on xor

Latest version **2.0.0** (published 2019-06-22) · AGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install cryptomancy-shard
pnpm add cryptomancy-shard
yarn add cryptomancy-shard
bun add cryptomancy-shard
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-06-22 |
| First published | 2019-06-06 |
| Weekly downloads | 0 |
| License | AGPL-3.0-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | ansuz |
| Maintainers | ansuz |
| Keywords | cryptomancy, secret, sharing, cryptography, otp, xor |

## Links

- npm: https://www.npmjs.com/package/cryptomancy-shard
- Repository: https://github.com/ansuz/cryptomancy-shard
- Homepage: https://github.com/ansuz/cryptomancy-shard#readme
- Issues: https://github.com/ansuz/cryptomancy-shard/issues
- npm.io page: https://npm.io/package/cryptomancy-shard

## Dependencies (1)

- [cryptomancy-util](https://npm.io/package/cryptomancy-util.md) ^1.0.3

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-06-22
- 1.0.0 — 2019-06-06

## README

# Cryptomancy-shard

For secret-sharing schemes which need support for threshold recombination there's [cryptomancy-secret](https://github.com/ansuz/cryptomancy-secret).
If your needs are _incredibly simple_, this module may provide a simpler option.

Its goal is to be:

* small
* fast
* flexible
* readable
* secure

It's missing:

* threshold support
* authentication
* padding bytes

## Use

```javascript
// the API takes and outputs Uint8Arrays
// so you'll probably want to convert between that and different formats
var Format = require("cryptomancy-format");

// it expects you to supply your own randomness
// so it can be deterministic if that suits your needs
// otherwise use a cryptographically secure source of random bytes
var Source = require("cryptomancy-source");
var secure_bytes = Source.bytes.secure();

var plaintext = "PEW PEW PEW";
var u8_message = Format.decodeUTF8(plaintext);

// load the library
var Shard = require("cryptomancy-shard");

// split the plaintext up into 5 shards
// all of which are necessary to reproduce the original value
var shards = Shard.split(secure_bytes, u8_message, 5);

// print out your shards in whatever format you like
// I like base64 because they're probably not valid UTF8
// and I don't like hex
console.log(shards.map(Format.encode64));

// join the shards
// order doesn't matter because internally it's just xor'ing the values
var recovered = Format.encodeUTF8(Shard.join(shards));

console.log(recovered);
```

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