Socket
Socket
Sign inDemoInstall

@whi/xor-digest

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@whi/xor-digest

Reduce a Uint8Array to a given length using an XOR pattern


Version published
Maintainers
2
Created
Source

xor_digest( bytes, length )

This micro-package provides a single method for reducing a Uint8Array to the given length using an XOR pattern.

Overview

Install

npm i @whi/xor-digest

Usage

const { xor_digest } = require('@whi/xor-digest');

let input = new Uint8Array([
    207,  39,   6,  42, 162,   2,  95, 176,
     73, 215,  86, 158, 133, 121,  16, 209,
    230, 217, 119, 208,  52, 155,  79,  31,
    250, 159,  28, 212, 252, 178, 226, 227
]);

xor_digest( input, 4 );
// Uint8Array([ 117, 228, 217, 45 ])

Alternatively, attach xor_digest to the native Uint8Array.prototype as a method (xorDigest()).

require('@whi/xor-digest').bindNative();

let input = new Uint8Array([
    207,  39,   6,  42, 162,   2,  95, 176,
     73, 215,  86, 158, 133, 121,  16, 209,
    230, 217, 119, 208,  52, 155,  79,  31,
    250, 159,  28, 212, 252, 178, 226, 227
]);

input.xorDigest( 4 );
// Uint8Array([ 117, 228, 217, 45 ])

Contributing

See CONTRIBUTING.md

FAQs

Package last updated on 15 Jun 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc