Method: Tem::Benchmarks#time_devchip_decrypt_3des_long

Defined in:
lib/tem/benchmarks/devchip_decrypt.rb

#time_devchip_decrypt_3des_longObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/tem/benchmarks/devchip_decrypt.rb', line 33

def time_devchip_decrypt_3des_long
  key = Tem::Keys::Symmetric.generate
  authz = [1] * 20
  key_id = @tem.tk_post_key key, authz
  data = (1...120).map { |i| (i * i * 217 + i * 661 + 393) % 256 }
  encrypted_data = key.encrypt data
  print "3DES-encrypted blob has #{encrypted_data.length} bytes\n"
  do_timing { @tem.devchip_decrypt encrypted_data, key_id }
  @tem.release_key key_id
end