Skip to content

Instantly share code, notes, and snippets.

View Nextt1's full-sized avatar
🏠
Working from home

Dhruvin Pipalia Nextt1

🏠
Working from home
View GitHub Profile
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const getCipherKey = require('./getCipherKey');
function decrypt({ file, password }) {
// First, get the initialization vector from the file.
const readInitVect = fs.createReadStream(file, { end: 15 });
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const AppendInitVect = require('./appendInitVect');
const getCipherKey = require('./getCipherKey');
function encrypt({ file, password }) {
// Generate a secure, pseudo random initialization vector.
@chris-rock
chris-rock / crypto-stream.js
Last active October 6, 2022 18:38
Encrypt and decrypt streams
// Part of https://github.com/chris-rock/node-crypto-examples
// Nodejs encryption of buffers
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
var fs = require('fs');
var zlib = require('zlib');