https://github.com/akazwz/use-hashcode
react use hashcode: hash大文件, hash 字符串, 支持 md5, sha1, sha256, sha512, 基于crypto-js
https://github.com/akazwz/use-hashcode
bigfile cryptojs hash hooks md5 react sha1 sha256 sha512
Last synced: about 2 months ago
JSON representation
react use hashcode: hash大文件, hash 字符串, 支持 md5, sha1, sha256, sha512, 基于crypto-js
- Host: GitHub
- URL: https://github.com/akazwz/use-hashcode
- Owner: akazwz
- License: mit
- Created: 2022-02-14T12:41:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-23T06:29:38.000Z (over 4 years ago)
- Last Synced: 2026-03-31T06:33:24.995Z (3 months ago)
- Topics: bigfile, cryptojs, hash, hooks, md5, react, sha1, sha256, sha512
- Language: TypeScript
- Homepage:
- Size: 131 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Installation
npm:
```shell
npm i use-hashcode
```
yarn:
```shell
yarn add use-hashcode
```
## Prepare
make sure you have crypto-js
```shell
npm i crypto-js
```
or
```shell
yarn add crypto-js
```
## Summary
This package makes hash things easier in react using crypto-js
## Usage
````tsx
import { useFileHashCode } from 'use-hashcode'
const App = () => {
const { isHashLoading, isHashError, sha256 } = useFileHashCode(file, 'sha256')
const strMd5 = useStringHashCode('Hello, World', 'md5')
return (
{sha256}
{strMd5}
)
}
````
## Hooks
### 1.useFileHashCode:
#### get hash code of file(include huge file), can custom chunk size, support MD5, Sha1, Sha256, Sha512
### 2.useStringHashCode:
#### get hash code of string, support MD5, Sha1, Sha256,Sha512