Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/3axap4ehko/subtlecrypto
https://github.com/3axap4ehko/subtlecrypto
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/3axap4ehko/subtlecrypto
- Owner: 3axap4eHko
- License: other
- Created: 2022-04-29T03:32:03.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T15:53:59.000Z (about 1 year ago)
- Last Synced: 2024-10-11T22:36:23.065Z (about 1 month ago)
- Language: TypeScript
- Size: 42 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# X-Cross
Provides the standard [Web Crypto API](https://www.w3.org/TR/WebCryptoAPI/) for NodeJS and Browser since both support it natively.
[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]## Example
```typescript
import { subtle } from 'xcross';const sha256 = async (input: string) => {
const encoder = new TextEncoder();
const data = encoder.encode(input);
const hashBuffer = await subtle.digest('SHA-256', data);
const hashArray = new Uint32Array(hashBuffer);return hashArray.map((b) => b.toString(16).padStart(int32.BYTES_PER_ELEMENT * 2, '0')).join('');
};
```## License
License [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
Copyright (c) 2023-present Ivan Zakharchanka[npm-url]: https://www.npmjs.com/package/xcross
[downloads-image]: https://img.shields.io/npm/dw/xcross.svg?maxAge=43200
[npm-image]: https://img.shields.io/npm/v/xcross.svg?maxAge=43200