79576631

Date: 2025-04-16 07:48:22
Score: 1.5
Natty:
Report link

I came to this post after searching for a simple method to make a two-way hash encryption, based on max's answer, I wrote a simple ts class to provide what I need for my project, this is the ts class I saved it on the gist EncryptLib.ts,

I use it as the following:

import EncryptLib from './EncryptLib'

// example of app key using randomBytes(32)
const appkey = crypto.randomBytes(32).toString('hex')

// instantiate the class
const encryptLib = new EncryptLib()

// create a hash for my-secret-string
const encrypted = encryptLib.encrypt("my-secret-string", appkey)
// sample results: 47952829ab7cc1c6e0aa82fcdcc4aea5:f14d2daf18c8da4c5ccc56e99933d338
// [ivhex:hexstring]

// get my string back
const decrypted = encryptLib.decrypt(encrypted, appkey)
Reasons:
  • Blacklisted phrase (0.5): I need
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: ino