Skip to content

react use hashcode: hash大文件, hash 字符串, 支持 md5, sha1, sha256, sha512, 基于crypto-js

License

Notifications You must be signed in to change notification settings

akazwz/use-hashcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

npm:

npm i use-hashcode

yarn:

yarn add use-hashcode

Prepare

make sure you have crypto-js

npm i crypto-js

or

yarn add crypto-js

Summary

This package makes hash things easier in react using crypto-js

Usage

import { useFileHashCode } from 'use-hashcode'

const App = () => {
  const { isHashLoading, isHashError, sha256 } = useFileHashCode(file, 'sha256')
  const strMd5 = useStringHashCode('Hello, World', 'md5')

  return (
    <div>
      {sha256}
      {strMd5}
    </div>
  )
}

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

About

react use hashcode: hash大文件, hash 字符串, 支持 md5, sha1, sha256, sha512, 基于crypto-js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published