Random Password Generator in Node.JS

The other day I thought about how to generate passwords from random arrays. Here is what I came up with: /* * RaNdom Password Generator */ const crypto = require(‘crypto’); const PASSWORD_LENGTH = 18; const LOWERCASE_ALPHABET = ‘abcdefghijklmnopqrstuvwxyz’; // 26 chars const UPPERCASE_ALPHABET = ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’; // 26 chars const NUMBERS = ‘0123456789’; // 10 chars const SYMBOLS = ‘,./<>?;\'”:[]\\|}{=-_+`~!@#$%^&*()’; // …

How to convert byte array to hex string in Java 1.8

If you like cryptography you might know that sometimes you have a byte array which you wish to convert to hexadecimal string. In java, to this day, I haven’t found yet a native class that does it, I’ve spent several minutes on the Internet looking for something like the Base64 class. Turns out Apache commons has a class called Hex.java …