Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
SymCryptor allows you to easy use a symmetric encryption (with AES-CTR-256) and a signature method (with KMAC-256)
SymCryptor allows you to easy use a symmetric encryption (with AES-CTR-256) and a signature method (with KMAC-256)
npm i symcryptor
npm test
const symCryptor = require( 'symcryptor' );
( async () => {
const clearText = 'Hello world!';
// For hashing
const hashSecret = await symCryptor.rndBytes( 32 ); // Return a random 256-bit Buffer
const digest = symCryptor.getHmac( clearText, hashSecret ); // Return a 512-bit Buffer as digest
// For encryption
const key = await symCryptor.rndBytes( 32 ); // Key must be a Buffer or Uint8Array of 512-bit
const encrypted = await symCryptor.encrypt( clearText, key, hashSecret ); // Return a Buffer
// For decryption
const decrypted = await symCryptor.decrypt( clearText, key, hashSecret ); // Return a Buffer
} )();
symCryptor.rndBytes
symCryptor.rndBytes( length: Number [, bytes: Boolean = false] )
length
Required - The length of random data in bytesbytes
Optional - If true
return Uint8Array
instead of Buffer
on fulfillmentRandom Buffer | Uint8Array
of selected length when Promise
resolved else throw an Error
symCryptor.getHmac
symCryptor.getHmac( data: String | Buffer | Uint8Array, key: Buffer | Uint8Array [, customization: String | Buffer | Uint8Array = '' [, bytes: Boolean = false]] )
data
Required - The data you want hashkey
Required - The secret key (it should be of 256-bit)customization
Optional - Some data you want to pass to hash algorithm (like AAD in AES-GCM)bytes
Optional - If true
return Uint8Array
instead of Buffer
A 512-bit Buffer | Uint8Array
as digest else throw an Error
symCryptor.encrypt
symCryptor.encrypt( data: String | Buffer | Uint8Array, key: Buffer | Uint8Array [, hashKey: Buffer | Uint8Array [, customization: String | Buffer | Uint8Array = '' [, bytes: Boolean = false]]] )
data
Required - The data you want to encryptkey
Required - The key you want to use for encryption (it must be of 256-bit)hashKey
Optional - The key you want to use to sign encrypted datacustomization
Optional - Some data you want to pass to hash algorithm (like AAD in AES-GCM)bytes
Optional - If true
return Uint8Array
instead of Buffer
on fulfillmentBuffer | Uint8Array
when Promise
resolved else throw an Error
symCryptor.decrypt
symCryptor.decrypt( data: Buffer | Uint8Array, key: Buffer | Uint8Array [, hashKey: Buffer | Uint8Array [, customization: String | Buffer | Uint8Array = '' [, bytes: Boolean = false]]] )
data
Required - The encrypted data you want to decryptkey
Required - The key you have to use for decryption (it must be of 256-bit)hashKey
Optional - The key you have to use to verify signature of encrypted data (required if data was signed)customization
Optional - Some data you have to pass to hash algorithm (like AAD in AES-GCM; required if it was passed during encryption)bytes
Optional - If true
return Uint8Array
instead of Buffer
on fulfillmentBuffer | Uint8Array
when Promise
resolved else throw an Error
FAQs
SymCryptor allows you to easy use a symmetric encryption (with AES-CTR-256) and a signature method (with KMAC-256)
We found that symcryptor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.