Skip to content

Commit 421aa6f

Browse files
📚 docs(README): First draft.
1 parent 944415f commit 421aa6f

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44
SHA1 bytestring hashing for JavaScript.
55
See [docs](https://string-hashing.github.io/sha1/index.html).
66

7-
> :building_construction: Caveat emptor! This is work in progress. Code may be
8-
> working. Documentation may be present. Coherence may be. Maybe.
9-
10-
> :warning: Depending on your environment, the code may require
11-
> `regeneratorRuntime` to be defined, for instance by importing
12-
> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).
7+
```js
8+
import {alloc} from '@array-like/alloc';
9+
import * as ascii from '@codec-bytes/ascii';
10+
import * as base16 from '@codec-bytes/base16';
11+
import {sha1} from '@string-hashing/sha1';
12+
const string = 'The quick brown fox jumps over the lazy dog';
13+
const bytes = ascii.encode(string);
14+
const digest = sha1(bytes, bytes.length * 8, alloc(20));
15+
digest; // [0x2f, 0xd4, 0xe1, 0xc6, 0x7a, 0x2d, 0x28, 0xfc, 0xed, 0x84, ...]
16+
base16.decode(digest); // '2FD4E1C67A2D28FCED849EE1BB76E7391B93EB12'
17+
```
1318

1419
[![License](https://img.shields.io/github/license/string-hashing/sha1.svg)](https://raw.githubusercontent.com/string-hashing/sha1/main/LICENSE)
1520
[![Version](https://img.shields.io/npm/v/@string-hashing/sha1.svg)](https://www.npmjs.org/package/@string-hashing/sha1)

doc/manual/usage.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
# Usage
22

3-
> :warning: Depending on your environment, the code may require
4-
> `regeneratorRuntime` to be defined, for instance by importing
5-
> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).
6-
7-
First, require the polyfill at the entry point of your application
8-
```js
9-
await import('regenerator-runtime/runtime.js');
10-
// or
11-
import 'regenerator-runtime/runtime.js';
12-
```
13-
14-
Then, import the library where needed
3+
Import the library where needed
154
```js
165
const sha1 = await import('@string-hashing/sha1');
176
// or

0 commit comments

Comments
 (0)