Sub CryptFile (path As String, infile As String, outfile As String)
dim buffersize as int = 1024*4
dim password = "mypassword"
Dim c As B4XCipher
Dim Ist As InputStream
Dim ost As OutputStream
Dim count As Int = 0
ost = File.OpenOutput(path,outfile,False)
Ist = File.OpenInput(path,infile)
Dim buffer(buffersize) As Byte
count = Ist.ReadBytes(buffer, 0, buffer.length)
Do While count <> -1
Dim outbuff () As Byte
outbuff = c.Encrypt(buffer,password)
ost.WriteBytes(outbuff,0,outbuff.Length)
count = Ist.ReadBytes(buffer, 0, buffer.length)
Loop
Ist.Close
ost.close
End Sub