yEnc/yDec algorithm (Including Multi-Part)

Category:
Network/Internet
Type:
Snippets
Difficulty:
Advanced

Author: Anne-Lise Pasch

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
I was writing a NewsReader the other day for a laugh and realised there's no VB code to yEnc/yDec (www.yenc.org) - its now used more than UUEncode and Mime/BinHex on Usenet. So after a frustrating and fruitless google, I wrote my own.

The encoder is 1.1 compliant, the decoder 1.2+ compliant. if you want 1.2 compliant encoding (not all newsgroups support) - you can tweak it a little following the specs on yenc.org.

Enjoy. Can be called thusly: Sub Main() WriteToFile "c:\file.ync", yEncodeFile("c:\calc.exe", 128) Kill "c:\calc.exe" DoEvents yDecodeFile "c:\file.ync" End Sub Me, I've made it a class for my own use because I want to call it async - But as the work's been done its up to you...

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: