Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@hapi/cryptiles
Advanced tools
@hapi/cryptiles is a utility library for cryptographic operations, providing functions for generating random strings, comparing secure strings, and other cryptographic utilities.
Random String Generation
Generates a random string of a specified length. In this example, a random string of 16 characters is generated.
const Cryptiles = require('@hapi/cryptiles');
const randomString = Cryptiles.randomString(16);
console.log(randomString);
Fixed Time Comparison
Compares two strings in a way that mitigates timing attacks. This example compares 'string1' and 'string2' and returns a boolean indicating if they are equal.
const Cryptiles = require('@hapi/cryptiles');
const result = Cryptiles.fixedTimeComparison('string1', 'string2');
console.log(result);
Token Generation
Generates a random token consisting of digits. In this example, a 6-digit random token is generated.
const Cryptiles = require('@hapi/cryptiles');
const token = Cryptiles.randomDigits(6);
console.log(token);
The built-in Node.js 'crypto' module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. It is more comprehensive and versatile compared to @hapi/cryptiles.
bcrypt is a library to help you hash passwords. While it focuses on password hashing and salting, it provides secure hashing mechanisms similar to some of the functionalities in @hapi/cryptiles.
uuid is a library for generating RFC-compliant UUIDs. It focuses on generating unique identifiers, which is a subset of the random string generation functionality provided by @hapi/cryptiles.
cryptiles is part of the hapi ecosystem and was designed to work seamlessly with the hapi web framework and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out hapi – they work even better together.
FAQs
General purpose crypto utilities
The npm package @hapi/cryptiles receives a total of 1,022,905 weekly downloads. As such, @hapi/cryptiles popularity was classified as popular.
We found that @hapi/cryptiles demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.