Advertisement
Guest User

Untitled

a guest
Nov 24th, 2019
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(arr){
  2.     let pattern = /((#|$|%|\*|&)(?<name>[A-Za-z]+)\2)=(?<length>\d+)!!(?<code>.+)/gm;
  3.     let decrypted ='';
  4.     for(let j = 0; j < arr.length; j++) {
  5.         let result = pattern.exec(arr[j]);
  6.         if(result){
  7.             let len = Number(result.groups.length);
  8.             if(result.groups.code.length === len){
  9.                 for(let i = 0; i < result.groups.code.length; i++){
  10.                     decrypted += String.fromCharCode(result.groups.code.charCodeAt(i) + len);
  11.                 }
  12.                 console.log(`Coordinates found! ${result.groups.name} -> ${decrypted}`);
  13.                 break;
  14.             } else{
  15.                 console.log('Nothing found!');
  16.             }  
  17.         } else{
  18.             console.log('Nothing found!');
  19.         }
  20.     }
  21. }
  22. solve([
  23.     'Ian6Hutchinson=7!!\\(58ycb4',
  24.     "#MikeHailwood#!!'gfzxgu6768=11",
  25.     'slop%16!!plkdek/.8x11ddkc',
  26.     '$Steve$=9Hhffjh',
  27.     "*DavMolyneux*=15!!efgk#'_$&UYV%h%",
  28.     'RichardQ^uayle=16!!fr5de5kd'
  29.   ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement