SHARE
TWEET

IBM S/36 account Decoder

a guest May 12th, 2018 136 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function h2d(h) { return parseInt(h,16); }
  5. function d2h(d) { return d.toString(16); }
  6. function decodeUsername(form) {
  7.     var SUV = new Array();
  8.     SUV[1]=h2d('32');
  9.     SUV[2]=h2d('0A');
  10.     SUV[3]=h2d('B9');
  11.     SUV[4]=h2d('16');
  12.     SUV[5]=h2d('8C');
  13.     SUV[6]=h2d('59');
  14.     SUV[7]=h2d('7E');
  15.     SUV[8]=h2d('A3');
  16.  
  17.     var PWD = new Array();
  18.     var Ldecoded = 0;
  19.  
  20.     form.sectorContents.value = form.sectorContents.value.split(' ').join('');
  21.         form.out.value = '';
  22.     for (var i=1;i<9;i++){
  23.         var LByte = form.sectorContents.value.slice(i*2,i*2+2);
  24.         if (i >=3 && i<=6) {
  25.             PWD[i-3] = h2d(LByte);
  26.         }
  27.         if (h2d(LByte) >= SUV[i]) {
  28.             Ldecoded = d2h(h2d(LByte) - SUV[i]);
  29.         } else {
  30.             Ldecoded = d2h((h2d(LByte)+h2d('100')) - SUV[i]);
  31.         }
  32.         form.out.value += h2e(Ldecoded);
  33.     }
  34.     form.out.value += ' / ';
  35.  
  36.     var SPV = new Array();
  37.     SPV[0] = h2d("B9");
  38.     SPV[1] = h2d("16");
  39.     SPV[2] = h2d("8C");
  40.     SPV[3] = h2d("59");
  41.     for (i=11;i < 15;i++) {
  42.         LByte = form.sectorContents.value.slice(i*2,i*2+2);
  43.         if (h2d(LByte) >= PWD[i-11]) {
  44.             Ldecoded = h2d(LByte) - PWD[i-11];
  45.         } else {
  46.             Ldecoded = h2d(LByte)+h2d('100') - PWD[i-11];
  47.         }
  48.         if (Ldecoded >= h2d(SPV[i-11])) {
  49.             Ldecoded = Ldecoded - SPV[i-11];
  50.         } else {
  51.             Ldecoded = Ldecoded+h2d('100') - SPV[i-11];
  52.         }
  53.         form.out.value += h2e(d2h(Ldecoded));
  54.     }
  55. }
  56. function h2e(hexbyte) {
  57. ebcdic = '.';
  58. switch(hexbyte.toUpperCase()) {
  59.     case '00': ebcdic = '<NUL>'; break;
  60.     case '01': ebcdic = '<SOH>'; break;
  61.     case '02': ebcdic = '<STX>'; break;
  62.     case '03': ebcdic = '<ETX>'; break;
  63.     case '04': ebcdic = '<SEL>'; break;
  64.     case '05': ebcdic = '<HT>' ; break;
  65.     case '06': ebcdic = '<RNL>'; break;
  66.     case '07': ebcdic = '<DEL>'; break;
  67.     case '08': ebcdic = '<GE>' ; break;
  68.     case '09': ebcdic = '<SPS>'; break;
  69.     case '0A': ebcdic = '<RPT>'; break;
  70.     case '0B': ebcdic = '<VT>' ; break;
  71.     case '0C': ebcdic = '<FF>' ; break;
  72.     case '0D': ebcdic = chr(13); break;
  73.     case '0E': ebcdic = '<SO>' ; break;
  74.     case '0F': ebcdic = '<SI>' ; break;
  75.     case '10': ebcdic = '<DLE>'; break;
  76.     case '11': ebcdic = '<DC1>'; break;
  77.     case '12': ebcdic = '<DC2>'; break;
  78.     case '13': ebcdic = '<DC3>'; break;
  79.     case '14': ebcdic = '<RES/ENP>'; break;
  80.     case '15': ebcdic = '<NL>' ; break;
  81.     case '16': ebcdic = '<BS>' ; break;
  82.     case '17': ebcdic = '<POC>'; break;
  83.     case '18': ebcdic = '<CAN>'; break;
  84.     case '19': ebcdic = '<EM>' ; break;
  85.     case '1A': ebcdic = '<UBS>'; break;
  86.     case '1B': ebcdic = '<CU1>'; break;
  87.     case '1C': ebcdic = '<IFS>'; break;
  88.     case '1D': ebcdic = '<IGS>' ; break;
  89.     case '1E': ebcdic = '<IRS>'; break;
  90.     case '1F': ebcdic = '<ITB/IUS>'; break;
  91.     case '20': ebcdic = '<DS>' ; break;
  92.     case '21': ebcdic = '<SOS>'; break;
  93.     case '22': ebcdic = '<FS>' ; break;
  94.     case '23': ebcdic = '<WUS>'; break;
  95.     case '24': ebcdic = '<BYP/INP>'; break;
  96.     case '25': ebcdic = '<LF>' ; break;
  97.     case '26': ebcdic = '<ETB>'; break;
  98.     case '27': ebcdic = '<ESC>'; break;
  99.     case '28': ebcdic = '<SA>' ; break;
  100.     case '29': ebcdic = '<SFE>'; break;
  101.     case '2A': ebcdic = '<SM/SW>'; break;
  102.     case '2B': ebcdic = '<CSP>'; break;
  103.     case '2C': ebcdic = '<MFA>'; break;
  104.     case '2D': ebcdic = '<ENQ>'; break;
  105.     case '2E': ebcdic = '<ACK>'; break;
  106.     case '2F': ebcdic = '<BEL>'; break;
  107.     case '30': break;
  108.     case '31': break;
  109.     case '32': ebcdic = '<SYN>'; break;
  110.     case '33': ebcdic = '<IR>' ; break;
  111.     case '34': ebcdic = '<PP>' ; break;
  112.     case '35': ebcdic = '<TRN>'; break;
  113.     case '36': ebcdic = '<NBS>'; break;
  114.     case '37': ebcdic = '<EOT>'; break;
  115.     case '38': ebcdic = '<SBS>'; break;
  116.     case '39': ebcdic = '<IT>' ; break;
  117.     case '3A': ebcdic = '<RFF>'; break;
  118.     case '3B': ebcdic = '<CU3>'; break;
  119.     case '3C': ebcdic = '<DC4>'; break;
  120.     case '3D': ebcdic = '<NAK>'; break;
  121.     case '3E': break;
  122.     case '3F': ebcdic = '<SUB>'; break;
  123.     case '40': ebcdic = ' ' ; break;
  124.     case '41': ebcdic = '<RSP>'; break;
  125.     case '42': break;
  126.     case '43': break;
  127.     case '44': break;
  128.     case '45': break;
  129.     case '46': break;
  130.     case '47': break;
  131.     case '48': break;
  132.     case '49': break;
  133.     case '4A': ebcdic = '['; break;
  134.     case '4B': ebcdic = '.'; break;
  135.     case '4C': ebcdic = '<'; break;
  136.     case '4D': ebcdic = '('; break;
  137.     case '4E': ebcdic = '+'; break;
  138.     case '4F': ebcdic = '|'; break;
  139.     case '50': ebcdic = '&'; break;
  140.     case '51': break;
  141.     case '52': break;
  142.     case '53': break;
  143.     case '54': break;
  144.     case '55': break;
  145.     case '56': break;
  146.     case '57': break;
  147.     case '58': break;
  148.     case '59': break;
  149.     case '5A': ebcdic = '!'; break;
  150.     case '5B': ebcdic = '$'; break;
  151.     case '5C': ebcdic = '*'; break;
  152.     case '5D': ebcdic = ')'; break;
  153.     case '5E': ebcdic = ';'; break;
  154.     case '5F': ebcdic = '^'; break;
  155.     case '60': ebcdic = '_'; break;
  156.     case '61': ebcdic = '/'; break;
  157.     case '62': break;
  158.     case '63': break;
  159.     case '64': break;
  160.     case '65': break;
  161.     case '66': break;
  162.     case '67': break;
  163.     case '68': break;
  164.     case '69': break;
  165.     case '6A': ebcdic = '|'; break;
  166.     case '6B': ebcdic = ','; break;
  167.     case '6C': ebcdic = '%'; break;
  168.     case '6D': ebcdic = '_'; break;
  169.     case '6E': ebcdic = '>'; break;
  170.     case '6F': ebcdic = '?'; break;
  171.     case '70': break;
  172.     case '71': break;
  173.     case '72': break;
  174.     case '73': break;
  175.     case '74': break;
  176.     case '75': break;
  177.     case '76': break;
  178.     case '77': break;
  179.     case '78': break;
  180.     case '79': ebcdic = '`'; break;
  181.     case '7A': ebcdic = ':'; break;
  182.     case '7B': ebcdic = '#'; break;
  183.     case '7C': ebcdic = '@'; break;
  184.     case '7D': ebcdic = "'"; break;
  185.     case '7E': ebcdic = '='; break;
  186.     case '7F': ebcdic = '"'; break;
  187.     case '80': break;
  188.     case '81': ebcdic = 'a'; break;
  189.     case '82': ebcdic = 'b'; break;
  190.     case '83': ebcdic = 'c'; break;
  191.     case '84': ebcdic = 'd'; break;
  192.     case '85': ebcdic = 'e'; break;
  193.     case '86': ebcdic = 'f'; break;
  194.     case '87': ebcdic = 'g'; break;
  195.     case '88': ebcdic = 'h'; break;
  196.     case '89': ebcdic = 'i'; break;
  197.     case '8A': break;
  198.     case '8B': ebcdic = '{'; break;
  199.     case '8C': break;
  200.     case '8D': break;
  201.     case '8E': break;
  202.     case '8F': ebcdic = '+'; break;
  203.     case '90': break;
  204.     case '91': ebcdic = 'j'; break;
  205.     case '92': ebcdic = 'k'; break;
  206.     case '93': ebcdic = 'l'; break;
  207.     case '94': ebcdic = 'm'; break;
  208.     case '95': ebcdic = 'n'; break;
  209.     case '96': ebcdic = 'o'; break;
  210.     case '97': ebcdic = 'p'; break;
  211.     case '98': ebcdic = 'q'; break;
  212.     case '99': ebcdic = 'r'; break;
  213.     case '9A': break;
  214.     case '9B': ebcdic = '}'; break;
  215.     case '9C': break;
  216.     case '9D': break;
  217.     case '9E': break;
  218.     case '9F': break;
  219.     case 'A0': break;
  220.     case 'A1': ebcdic = '~'; break;
  221.     case 'A2': ebcdic = 's'; break;
  222.     case 'A3': ebcdic = 't'; break;
  223.     case 'A4': ebcdic = 'u'; break;
  224.     case 'A5': ebcdic = 'v'; break;
  225.     case 'A6': ebcdic = 'w'; break;
  226.     case 'A7': ebcdic = 'x'; break;
  227.     case 'A8': ebcdic = 'y'; break;
  228.     case 'A9': ebcdic = 'z'; break;
  229.     case 'AA': break;
  230.     case 'AB': break;
  231.     case 'AC': break;
  232.     case 'AD': ebcdic = '['; break;
  233.     case 'AE': break;
  234.     case 'AF': break;
  235.     case 'B0': break;
  236.     case 'B1': break;
  237.     case 'B2': break;
  238.     case 'B3': break;
  239.     case 'B4': break;
  240.     case 'B5': break;
  241.     case 'B6': break;
  242.     case 'B7': break;
  243.     case 'B8': break;
  244.     case 'B9': break;
  245.     case 'BA': break;
  246.     case 'BB': break;
  247.     case 'BC': break;
  248.     case 'BD': break;
  249.     case 'BE': break;
  250.     case 'BF': break;
  251.     case 'C0': ebcdic = '{'; break;
  252.     case 'C1': ebcdic = 'A'; break;
  253.     case 'C2': ebcdic = 'B'; break;
  254.     case 'C3': ebcdic = 'C'; break;
  255.     case 'C4': ebcdic = 'D'; break;
  256.     case 'C5': ebcdic = 'E'; break;
  257.     case 'C6': ebcdic = 'F'; break;
  258.     case 'C7': ebcdic = 'G'; break;
  259.     case 'C8': ebcdic = 'H'; break;
  260.     case 'C9': ebcdic = 'I'; break;
  261.     case 'CA': break;
  262.     case 'CB': break;
  263.     case 'CC': break;
  264.     case 'CD': break;
  265.     case 'CE': break;
  266.     case 'CF': break;
  267.     case 'D0': ebcdic = '}'; break;
  268.     case 'D1': ebcdic = 'J'; break;
  269.     case 'D2': ebcdic = 'K'; break;
  270.     case 'D3': ebcdic = 'L'; break;
  271.     case 'D4': ebcdic = 'M'; break;
  272.     case 'D5': ebcdic = 'N'; break;
  273.     case 'D6': ebcdic = 'O'; break;
  274.     case 'D7': ebcdic = 'P'; break;
  275.     case 'D8': ebcdic = 'Q'; break;
  276.     case 'D9': ebcdic = 'R'; break;
  277.     case 'DA': break;
  278.     case 'DB': break;
  279.     case 'DC': break;
  280.     case 'DD': break;
  281.     case 'DE': break;
  282.     case 'DF': break;
  283.     case 'E0': ebcdic = '\\'; break;
  284.     case 'E1': break;
  285.     case 'E2': ebcdic = 'S'; break;
  286.     case 'E3': ebcdic = 'T'; break;
  287.     case 'E4': ebcdic = 'U'; break;
  288.     case 'E5': ebcdic = 'V'; break;
  289.     case 'E6': ebcdic = 'W'; break;
  290.     case 'E7': ebcdic = 'X'; break;
  291.     case 'E8': ebcdic = 'Y'; break;
  292.     case 'E9': ebcdic = 'Z'; break;
  293.     case 'EA': break;
  294.     case 'EB': break;
  295.     case 'EC': break;
  296.     case 'ED': break;
  297.     case 'EE': break;
  298.     case 'EF': break;
  299.     case 'F0': ebcdic = '0'; break;
  300.     case 'F1': ebcdic = '1'; break;
  301.     case 'F2': ebcdic = '2'; break;
  302.     case 'F3': ebcdic = '3'; break;
  303.     case 'F4': ebcdic = '4'; break;
  304.     case 'F5': ebcdic = '5'; break;
  305.     case 'F6': ebcdic = '6'; break;
  306.     case 'F7': ebcdic = '7'; break;
  307.     case 'F8': ebcdic = '8'; break;
  308.     case 'F9': ebcdic = '9'; break;
  309.     case 'FA': break;
  310.     case 'FB': break;
  311.     case 'FC': break;
  312.     case 'FD': break;
  313.     case 'FE': break;
  314.     case 'FF': break;
  315.     default : ebcdic = '<<UNHANDLED CODE>>'; break;
  316.     }
  317. return ebcdic;
  318. }
  319. </script>
  320. </head>
  321. <form>
  322. IBM System/36 sector:<br><input name=sectorContents type="text" size=48 maxlength=48 onChange="decodeUsername(this.form)">
  323. <input onclick="decodeUsername(this.form)" value="decode" type="button" />
  324. <br>
  325. <textarea name=out nowrap rows=1 cols=30 style="font-family:Courier;font-size:16px"></textarea>
  326. </form>
  327. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top