leomaster

ghost b64

Nov 17th, 2021 (edited)
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Transforms any text to a zero width string
  2. // technically there's room for 80 mappings
  3. // but we settle to use btoa first thus 65 chars are mapped
  4. // there is a div/mod loop way to generate the inv
  5. // for b64 alphabet plain text is almost best choice
  6. // call with param invisible results into original text
  7. // ----------
  8. // masterleo@gmail.com 18/11/2021
  9.  
  10. const ghost = λ => (Λ=Object.fromEntries([...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='].reduce((m,a,p)=>[...m, [a, $=String.fromCodePoint(8234+p/16|0, 8288+p%16)], [$, a]],[])), λ.charAt() in Λ ? btoa(λ).replace(/./g, $=>Λ[$] || '') : atob(λ.replace(/../g, $=>Λ[$] || '')));
  11.  
  12. //call res = ghost(code) with normal code text to return the invisible result
  13. let hide = ghost( "open`https://youtu.be/dQw4w9WgXcQ`" );
  14. console.log(hide); // invisible
  15.  
  16. //call ghost with param being invisible character collection to return original text
  17. let show = ghost(hide);
  18. console.log(show);
  19. \u0065val(show);
  20.  
  21.  
  22. /////////////////
  23.  
  24.  
  25. const ghost = λ => ((λ,c,r,f,s,M)=>(M=JSON.parse('{'+`${[][c](124)}`[r](/./g,($,i)=>c[c][f](i))[r](/[^A-Z0-9+/=]/gi,'')[r](/./g,($,i)=>`"${$}":"${s=c[c][f](8234+i/16|0,8288+i%16)}","${s}":"${$}",`)[r](/,$/,'}')),λ.at() in M?btoa(λ)[r](/./g,$=>M[$]):atob(λ[r](/../g,$=>M[$]))))(λ,'constructor','replace','fromCodePoint');
  26.  
  27. let hide = ghost( "open`https://youtu.be/dQw4w9WgXcQ`" );
  28. console.log(hide);
  29.  
  30. let show = ghost(hide);
  31. console.log(show);
  32. // execute
  33. \u0065val(show);
Add Comment
Please, Sign In to add comment