Advertisement
NusanTech

Young-Encrypter

Jul 12th, 2025
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TypeScript 2.35 KB | Cybersecurity | 0 0
  1. // Expo testing security
  2. // Kalau mau tamba fitur agar lebih aman lagi ya silahkan ya
  3. // Lisensi? Tidak ada lisensi apapun di kode ini
  4. // Lu bebas dan lu bisa melakukan apa saja
  5.  
  6. export const CHAR_MAP: Record<string, string> = {
  7.     ' ': '§20', '!': '§21', '"': '§22', '#': '§23', '$': '§24', '%': '§25', '&': '§26',
  8.     "'": '§27', '(': '§28', ')': '§29', '*': '§2a', '+': '§2b', ',': '§2c', '-': '§2d',
  9.     '.': '§2e', '/': '§2f', '0': '§30', '1': '§31', '2': '§32', '3': '§33', '4': '§34',
  10.     '5': '§35', '6': '§36', '7': '§37', '8': '§38', '9': '§39', ':': '§3a', ';': '§3b',
  11.     '<': '§3c', '=': '§3d', '>': '§3e', '?': '§3f', '@': '§40', 'A': '§41', 'B': '§42',
  12.     'C': '§43', 'D': '§44', 'E': '§45', 'F': '§46', 'G': '§47', 'H': '§48', 'I': '§49',
  13.     'J': '§4a', 'K': '§4b', 'L': '§4c', 'M': '§4d', 'N': '§4e', 'O': '§4f', 'P': '§50',
  14.     'Q': '§51', 'R': '§52', 'S': '§53', 'T': '§54', 'U': '§55', 'V': '§56', 'W': '§57',
  15.     'X': '§58', 'Y': '§59', 'Z': '§5a', '[': '§5b', '\\': '§5c', ']': '§5d', '^': '§5e',
  16.     '_': '§5f', '`': '§60', 'a': '§61', 'b': '§62', 'c': '§63', 'd': '§64', 'e': '§65',
  17.     'f': '§66', 'g': '§67', 'h': '§68', 'i': '§69', 'j': '§6a', 'k': '§6b', 'l': '§6c',
  18.     'm': '§6d', 'n': '§6e', 'o': '§6f', 'p': '§70', 'q': '§71', 'r': '§72', 's': '§73',
  19.     't': '§74', 'u': '§75', 'v': '§76', 'w': '§77', 'x': '§78', 'y': '§79', 'z': '§7a',
  20.     '{': '§7b', '|': '§7c', '}': '§7d', '~': '§7e'
  21. };
  22.  
  23. const REVERSE_MAP: Record<string, string> = Object.fromEntries(
  24.     Object.entries(CHAR_MAP).map(([k, v]) => [v, k])
  25. );
  26.  
  27. export function encrypt(text: string): string {
  28.     return [...text].map(char => CHAR_MAP[char] ?? char).join('');
  29. }
  30.  
  31. export function decrypt(cipher: string): string {
  32.     const regex = /§[0-9a-f]{2}/g;
  33.     return cipher.replace(regex, match => REVERSE_MAP[match] ?? match);
  34. }
  35.  
  36.  
  37. // Dibawah ini untuk cara penggunakan di nodeJS dan atas adalah fungsi buatan sendiri untuk enkripsi dan dekripsi
  38. // Made by WNIYoung With Coffie
  39.  
  40. //** const original = fs.readFileSync('tes.txt', 'utf8'); untuk di file manamun kecuali dokumen
  41. //** const original = "Tes teks"; untuk langsung
  42.  
  43. //** const encrypted = encrypt(original);
  44. //** const decrypted = decrypt(original);
  45.  
  46. //** console.log(encrypted);
  47. //** console.log(decrypted); */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement