SUI-Components / sui

Monorepo for SUI (Simple User Interface) packages.
169 stars 33 forks source link

feat(packages/sui-js): Add sha256 hash method #1734

Closed ivanmlaborda closed 6 months ago

ivanmlaborda commented 6 months ago

Description

We are adding the sha256 hash method to sui-js utilities. This new function uses browser native methods so we are not coupling it to third-party libraries. This method will be async, so we are naming it createAsyncSha256.

https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#converting_a_digest_to_a_hex_string

Example

import {createAsyncSha256} from '@s-ui/js/lib/hash'

const hashedValue = await createAsyncSha256(value)

jordevo commented 6 months ago

pretty safe to use with our main user base...

image