[VB6 equivalent: PC1_File]
Const MY_PATH As String = ".\"
Dim abKey(5) As Byte
Dim strFileOut As String
Dim strFileIn As String
Dim strFileChk As String
Dim nRet As Integer
Console.WriteLine("Test_PC1_File...")
' Construct full path names to files
strFileIn = MY_PATH & "hello.txt"
strFileOut = MY_PATH & "hello.pc1.enc.dat"
strFileChk = MY_PATH & "hello.pc1.chk.txt"
' Setup the 6-byte key "abcxyz"
abKey(0) = Asc("a")
abKey(1) = Asc("b")
abKey(2) = Asc("c")
abKey(3) = Asc("x")
abKey(4) = Asc("y")
abKey(5) = Asc("z")
' Encipher plaintext file
nRet = Pc1.File(strFileOut, strFileIn, abKey)
Console.WriteLine("PC1_File returns " & nRet)
' Now decipher just by repeating
nRet = Pc1.File(strFileChk, strFileOut, abKey)
Console.WriteLine("PC1_File returns " & nRet)
See Also:
Pc1.File Method