@plmservices/nativescript-sha
v2.0.2
Published
Nativescript SHA (HMAC-SHA) plugin.
Maintainers
Readme
NativeScript SHA/HMAC

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-shaUsage
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 :)
License
Apache License Version 2.0, January 2004

