
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
cryptography
Advanced tools
Simplified functions for nodejs cryptography.
options
<Object>
| <string>
options.key
<string>
options.algorithm
<string>
options.encoding
<string>
options.data
<string>
options.callback
<Function>
Returns a promise which is resolved with encrypted string. If a callback is passed it is called with encrypted string.
options
<Object>
| <string>
options.key
<string>
options.algorithm
<string>
options.encoding
<string>
options.data
<string>
Synchronous encrypt(). Returns encrypted string.
options
<Object>
| <string>
options.key
<string>
options.algorithm
<string>
options.encoding
<string>
options.data
<string>
options.callback
<Function>
Returns a promise which is resolved with decrypted string. If a callback is passed it is called with decrypted string.
options
<Object>
| <string>
options.key
<string>
options.algorithm
<string>
options.encoding
<string>
options.data
<string>
Synchronous decrypt(). Returns decrypted string.
options
<Object>
| <string>
options.key
<string>
options.algorithm
<string>
options.encoding
<string>
options.data
<string>
options.callback
<Function>
Returns a promise which is resolved with hashed string. If a callback is passed it is called with hashed string.
options
<Object>
| <string>
options.key
<string>
options.algorithm
<string>
options.encoding
<string>
options.data
<string>
Synchronous hmac(). Returns hashed string.
options
<Object>
| <string>
options.key
<string>
options.algorithm
<string>
options.encoding
<string>
options.data
<string>
options.callback
<Function>
Returns a promise which is resolved with hashed string. If a callback is passed it is called with hashed string.
options
<Object>
| <string>
options.key
<string>
options.algorithm
<string>
options.encoding
<string>
options.data
<string>
Synchronous hash(). Returns hashed string.
options
<Object>
| <Number>
options.size
<Number>
options.encoding
<string>
options.callback
<Function>
Returns a promise which is resolved with random bytes string. If a callback is passed it is called with random bytes string.
Synchronous randomBytes(). Returns random bytes string.
const cryptography = require("cryptography");
// Set defaults
cryptography.defaults.key = "password";
cryptography.defaults.encryptionAlgorithm = "aes192";
cryptography.defaults.encoding = "hex";
// Use defaults
cryptography.encrypt("string to encrypt")
.then(function(encrypted)
{
return cryptography.decrypt(encrypted);
})
.then(function(decrypted)
{
console.log(decrypted) // outputs: "string to encrypt"
})
.catch(function(error)
{
// An error occurred
});
// Override defaults for one call
cryptography.encrypt({
key: "another password",
data: "string to encrypt"
})
.then(function(encrypted)
{
return cryptography.decrypt({
key: "another password",
data: encrypted
});
})
.then(function(decrypted)
{
console.log(decrypted) // outputs: "string to encrypt"
})
.catch(function(error)
{
// An error occurred
});
const cryptography = require("cryptography");
var decryptCallback = function(error, decrypted)
{
if(error)
{
// Error occurred
return;
}
console.log(decrypted);
};
var encryptCallback = function(error, encrypted)
{
if(error)
{
// Error occurred
return;
}
cryptography.decrypt({
data: encrypted,
callback: decryptCallback
});
};
cryptography.encrypt({
data: "string to encrypt",
callback: encryptCallback
});
const cryptography = require("cryptography");
try
{
var encrypted = cryptography.encryptSync("string to encrypt");
var decrypted = cryptography.decryptSync(encrypted);
}
catch(error)
{
// Error occurred
return;
}
console.log(decrypted);
FAQs
Simplified functions for nodejs cryptography.
The npm package cryptography receives a total of 448 weekly downloads. As such, cryptography popularity was classified as not popular.
We found that cryptography 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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.