UNPKG

@omnimedia/omnitool

Version:

open source video processing tools

21 lines 640 B
import { Hex, Thumbprint } from "@e280/stz"; export class Checksum { data; bytes; hash; nickname; constructor(data, bytes, hash, nickname) { this.data = data; this.bytes = bytes; this.hash = hash; this.nickname = nickname; } static async make(data) { const data2 = new Uint8Array(data); const bytes = new Uint8Array(await crypto.subtle.digest("SHA-256", data2)); const hash = Hex.fromBytes(bytes); const nickname = Thumbprint.sigil.fromBytes(bytes); return new this(data, bytes, hash, nickname); } } //# sourceMappingURL=checksum.js.map