Function yDecode(strText) 'yDecoding invloves subtracting 42 from the value of every 'byte (Mod 256). A special case is made if the input character 'is the special escape character "=". In that case, the following 'character has an additional 64 subtracted from it (Mod 256). 'Because NULL, CR, and LF are not allowed in a yEnc stream, they 'are ignored if they are encountered. Please refer to www.yenc.org 'for more details Dim strIn, strOut, strChar, strIgnore Dim intOut, lngLength, lngCount Dim blnEscape strOut = "" strIgnore = Chr(0) & Chr(10) & Chr(13) strIn = strText blnEscape = False lngLength = Len(strIn) For lngCount = 1 To lngLength strChar = Mid(strIn, lngCount, 1) intOut = Asc(strChar) If InStr(strIgnore, strChar) = 0 Then If strChar = "=" Then 'the escape character blnEscape = True Else If blnEscape Then intOut = intOut - 64 blnEscape = False End If intOut = intOut - 42 If intOut < 0 Then intOut = intOut + 256 strOut = strOut & Chr(intOut) End If End If Next yDecode = strOut End Function Function yEncode(strText) 'yEncoding is a simple ROT-42 of an eight-bit word. A few output values 'are "escaped" by preceeding them with an equal sign and performing an 'additional ROT-64. Escaped characters must include 0(NULL), 10(LF), '13(CR), 61(=), and may include 32(SPACE), 9(TAB), and 46(.) 'Please refer to www.yenc.org for more information Dim strIn, strOut, strEscapes Dim intOut, lngCount, lngLength strEscapes = Chr(0) & Chr(10) & Chr(13) & Chr(61) & Chr(32) & Chr(9) & Chr(46) strOut = "" strIn = strText lngLength = Len(strIn) For lngCount = 1 To lngLength intOut = Asc(Mid(strIn, lngCount, 1)) intOut = (intOut + 42) Mod 256 If InStr(strEscapes, Chr(intOut)) = 0 Then strOut = strOut & Chr(intOut) Else strOut = strOut & "=" & Chr((intOut + 64) Mod 256) End If Next yEncode = strOut End Function