Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@utilify/crypto

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@utilify/crypto

These functions are useful for ensuring data security and integrity in web and back-end applications.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
0
Created
Source

Utilities - Crypto

The Crypto category provides functions that help with generating cryptographic hashes and creating unique identifiers. These functions are useful for ensuring data security and integrity in web and back-end applications.

Installation

To install the Crypto package, use one of the following commands:

npm install @utilify/crypto
yarn add @utilify/crypto
pnpm add @utilify/crypto

Import the functions into your project:

import { djb2, hash, randomUUID } from '@utilify/crypto';
const { djb2, hash, randomUUID } = require('@utilify/crypto');

Overview

djb2

function djb2(str: string): string;

Calculates the DJB2 hash of a string. The DJB2 algorithm is a fast and efficient way to generate a hash from a text input.

hash

async function hash(
  data: string | ArrayBuffer | DataView,
  algorithm: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512',
  output: 'hex' | 'base64' | 'buffer' = 'buffer'
): Promise<string | ArrayBuffer | undefined>;

Generates a cryptographic hash of the given data using the specified algorithm and output format.

randomUUID

function randomUUID(): string | undefined;

Generates a secure UUID using the browser's Web Crypto API. Returns undefined if the API is unavailable.

Keywords

crypto

FAQs

Package last updated on 12 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts