Sample code for 30+ languages & platforms
Ruby

Workaround for the deprecated Crypt2.CrcBytes method

Shows how to replace the deprecated CrcBytes 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"
algorithm = "crc-32"

# ------------------------------------------------------------------------
# The CrcBytes method is deprecated:

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

crc = crypt.CrcBytes(algorithm,inData)

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

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

crc = crypt.CrcBd(algorithm,bdIn)