All pastes #635136 Raw Edit

Ln

public text v1 · immutable
#635136 ·published 2007-07-26 21:30 UTC
rendered paste body
Option Explicit
'Created by Ln
'A special thanks to Pete McMillan for his enthusiasm and support
'If someone is up to the task of batching this routine, feel free to bug me with any issues
'Note: The initial 'Enc' string can be interchanged with any other string of 55 characters (as demonstrated by the comments)

Dim i

MsgBox Enc(InputBox("Enter text","Avaya Encryption Function Test"))
MsgBox uEnc(InputBox("Enter text","Avaya Decryption Function Test"))

Function Enc(strp)
  If Not Len(strp) > 0 Then Exit Function
  Enc = "ej2y5neeDwdufpa5Mo0jd3basoe7nkiSoUrrt8ehRNc21Lefwhng46?"
  'Enc = "*******************************************************"
  'Enc = Space(55)
  strp = Left(strp, 48)
  For i = 1 To Len(strp)
    Enc = Mid(Enc,49,6) & Mid(strp,i,1) & Left(Enc,48)
  Next
  Enc = Chr(33 + Len(strp)) & Enc
End Function

Function uEnc(strh)
  Dim lenp
  If Not Len(strh) = 56 Then Exit Function
  lenp = Asc(Left(strh,1)) - 33
  strh = Mid(strh,2)
  For i = lenp To 1 Step -1
    uEnc = Mid(strh, 7, 1) & uEnc
    strh = Mid(strh, 8) & Left(strh, 7)
  Next
End Function