Sample code for 30+ languages & platforms
Ruby

Workaround for the deprecated Crypt2.Encode method

Shows how to replace the deprecated Encode method. (Chilkat is moving away from the use of CkByteData.)

Chilkat Ruby Downloads

Ruby
require 'chilkat'

crypt = Chilkat::CkCrypt2.new()

path = "c:/someDir/example.dat"

# Such as base64, hex, hex_lower, etc.
encoding = "base64"

# ------------------------------------------------------------------------
# The Encode method is deprecated:

inData = Chilkat::CkByteData.new()
inData.loadFile(path)

encodedBytes = crypt.encode(inData,encoding)

# ------------------------------------------------------------------------
# Workaround.
# (Chilkat is moving away from using CkByteData)

bd = Chilkat::CkBinData.new()
bd.LoadFile(path)

encodedBytes = bd.getEncoded(encoding)