Skip to content

Instantly share code, notes, and snippets.

@blueprin4
blueprin4 / conver.js
Created April 14, 2023 19:24 — forked from TPXP/conver.js
PHPass 64-encoding conversion
const phpassbase64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
const base64translate = (input) => {
const res = [0];
let currentBit = 0, index = 0;
input.split('').forEach(l => {
const i = phpassbase64.indexOf(l);
res[index] += (i << currentBit) & 0xff;
currentBit += 6;
if(currentBit >= 8) {