Sha256: 921f7ff9bb4c16af3d6f8b5f1966d8ee416b96efae35a5de076926f432af4c94
Contents?: true
Size: 977 Bytes
Versions: 1
Compression:
Stored size: 977 Bytes
Contents
#!/usr/bin/env ruby require "ffxcodec" require "pp" a_val = 1234567890 b_val = 4 a_size = 40 b_size = 24 key = "2b7e151628aed2a6abf7158809cf4f3c" tweak = "9876543210" ffx = FFXCodec.new(a_size, b_size) # divide 64-bit int into a 40 and 24-bit int unencrypted_encoded = ffx.encode(a_val, b_val) unencrypted_decoded = ffx.decode(unencrypted_encoded) ffx.setup_encryption(key, tweak) encrypted_encoded = ffx.encode(a_val, b_val) encrypted_decoded = ffx.decode(encrypted_encoded) puts "Input A: #{a_val}" puts "Input B: #{b_val}" puts "Input A bit allocation: #{a_size}" puts "Input B bit allocation: #{b_size}" puts "Encoded Size (Type): #{ffx.size} bytes (#{ffx.bit_length}-bit unsigned integer)" puts "" puts "Without Encryption:" puts "- Encoded: #{unencrypted_encoded}" puts "- Decoded: #{unencrypted_decoded.inspect}" puts "" puts "With Encryption: (Key: #{key}, Tweak: #{tweak})" puts "- Encoded: #{encrypted_encoded}" puts "- Decoded: #{encrypted_decoded.inspect}"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ffxcodec-0.1.0 | exe/ffxcodec-demo |