Hash/UnHashing Script

By Roy911 on Aug 08, 2007

RoyServ Hash/UnHashing Script -Version 1.2- (c) Copyright Roy911 2007

For support, email RoyServ@gmail.com, or visit us at irc.RivalSource.net, Channel #Roy911.

This snippet creates a random 'hash' value that is used to process and evaluate the string, to create something like: +167+157+234+181 38wA474336D278kSOCwq. The first part '+167+157+234+181' is the string 'test' hashed with the hash phrase '38wA474336D278kSOCwq'.

The string '+167+157+234+181' can only be decoded with the hash '38wA474336D278kSOCwq' or else the string will be translated into meaningless junk.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;             RoyServ Hash/UnHashing Script             ;;
;;               (c) Copyright Roy911 2007               ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  Usage:                                               ;;
;;  Hash: //echo -a $HashRSC(asdf)                       ;;
;;  Output returns the hashed phrase + hash code used    ;;
;;  Note: you may also specify your own hash (20 chars)  ;;
;;-------------------------------------------------------;;
;;  UnHash: //echo -a $UnHashRSC(String,Hash)            ;;
;;Returns Phrase unhashed. (only works with correct hash);;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; As the creator of this script, I allow you to use and ;;
;; modify this script. You may however, NOT redistribute ;;
;; this code in any form, edited or not.                 ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias HashRSC {
  var %hash = $iif($2 != $null,$2,$randpingen(20)), %pos = 1, %string = $1, %r
  while (%pos <= $len(%string)) {
    var %svar = $asc($mid(%string,%pos,1)), %pvar = $asc($mid(%hash,%pos,1)) | if (%pos > 20) { var %pvar = $asc($mid(%hash,$calc(%pos - 1),1)) } 
    var %tvar = $calc(%svar + %pvar), %r = %r $+ $chr(32) $+ %tvar
    inc %pos
  }
  return $replace(%r,$chr(32),$chr(43)) %hash
}

alias UnHashRSC {
  var %hash = $2, %pos = 1, %string = $1, %r, %len = $numtok(%string,43)
  while (%pos <= %len) {
    var %hashchr = $mid(%hash,$iif(%pos > 20,$calc(%pos - 20),%pos),1), %subvar = $asc(%hashchr), %sub = $calc($gettok(%string,%pos,43) - %subvar), %tvar = $chr(%sub), %r = %r $+ %tvar
    inc %pos
  }
  return %r
}

alias randpingen {
  var %string, %len = $1
  if ($1 !isnum) { goto skip }
  while ($len(%string) != %len) {
    var %rand = $rand(1,2) 
    if (%rand == 1) {
      var %ud = $rand(1,2), %alpha = $rand(1,26)
      if (%ud == 1) { var %add = $chr($calc(64 + %alpha)), %asdf = $calc(64 + %rand) }
      else { var %add = $chr($calc(64 + (%alpha + 32))), %asdf = $calc(64 + (%rand + 32)) }
    }
    else { var %add = $rand(0,9) }
    var %string = %string $+ %add
  }
  return %string
  :skip
}

Comments

Sign in to comment.
Anti   -  Aug 10, 2007

ROFL i dont get what it does.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.