Skip to content

Instantly share code, notes, and snippets.

View diazoxide's full-sized avatar
🖱️
Finding solutions!

Aaron Yordanyan diazoxide

🖱️
Finding solutions!
View GitHub Profile
@diazoxide
diazoxide / custom_crypto_algorithm.js
Created March 23, 2023 12:04
Custom strong cryptography algorithm on JS
function xorWithKey(input, key) {
let output = "";
for (let i = 0; i < input.length; i++) {
let keyChar = String(key[i % key.length]);
output += String.fromCharCode(input.charCodeAt(i) ^ keyChar.charCodeAt(0));
}
return output;
}
function customSubstitution(input, substitutionTable) {
@diazoxide
diazoxide / strong-password.ts
Created March 22, 2023 07:30
TypeScript generate strong password
function generateRandomSecret(length = 32): string {
const haystacks = [
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"0123456789",
"~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/"
];
const randomPart = (haystack: string, length: number)=>{
let retVal = "";
for (let i = 0, n = haystack.length; i < length; ++i) {