Necessary Pigeonholing Mechanism

    @plmservices/nativescript-sha
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.2 • Public • Published

    NativeScript SHA/HMAC apple android

    npm npm Build Status Donate

    This plugin gives access to native SHA generation code on iOS and Android.

    Supports SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512.

    Also support HMAC for all supported SHA hashes.

    Prerequisites / Requirements

    None.

    Installation

    To install, simply run:

    ns plugin add @plmservices/nativescript-sha

    Usage

    To use this module you must first require() it:

    // Javascript
    var Sha = require('@plmservices/nativescript-sha');
    var sha = new Sha.Sha();

    Or if you're using Typescript, import the module:

    // Typescript
    import { Sha } from '@plmservices/nativescript-sha');
    const sha = new Sha();

    After you have a reference to the module you call the hash functions:

    // Typescript
    import { Sha } from '@plmservices/nativescript-sha';
    const sha = new Sha();
    
    console.log(`Hash is ${sha.Sha256("this is our test data")}`);
    
    console.log(`Hmac is ${sha.HmacSha256("secretkey", "this is our test data")}`);

    API

    Methods

    Method Description
    public Sha1(input: string): string; Calculate SHA1 of supplied input data
    public Sha224(input: string): string; Calculate SHA224 of supplied input data
    public Sha256(input: string): string; Calculate SHA256 of supplied input data
    public Sha384(input: string): string; Calculate SHA384 of supplied input data
    public Sha512(input: string): string; Calculate SHA512 of supplied input data
    public HmacSha1(key: string, input: string): string; Calculate HMAC using SHA1 of supplied input data with supplied key
    public HmacSha224(key: string, input: string): string; Calculate HMAC using SHA224 of supplied input data with supplied key
    public HmacSha256(key: string, input: string): string; Calculate HMAC using SHA256 of supplied input data with supplied key
    public HmacSha384(key: string, input: string): string; Calculate HMAC using SHA384 of supplied input data with supplied key
    public HmacSha512(key: string, input: string): string; Calculate HMAC using SHA512 of supplied input data with supplied key

    TODO

    • Angular demo app
    • Vue demo app

    Donation

    If this project helped you reduce your development time, you could consider helping me with a cup of coffee or some electricity :)

    Donate

    License

    Apache License Version 2.0, January 2004

    Install

    npm i @plmservices/nativescript-sha

    DownloadsWeekly Downloads

    9

    Version

    2.0.2

    License

    Apache-2.0

    Unpacked Size

    31.7 kB

    Total Files

    13

    Last publish

    Collaborators

    • gallandro