Sha256: 5767514386a900fd51f7dd897d6a9529699c5632d209f0579bcbe9b0aa6cea31
Contents?: true
Size: 503 Bytes
Versions: 1
Compression:
Stored size: 503 Bytes
Contents
module Fernet module BitPacking extend self # N.B. Ruby 1.9.2 and below silently ignore endianness specifiers in # packing/unpacking format directives; we work around it with this def pack_int64_bigendian(value) (0..7).map { |index| (value >> (index * 8)) & 0xFF }.reverse.map(&:chr).join end def unpack_int64_bigendian(bytes) bytes.each_byte.to_a.reverse.each_with_index. reduce(0) { |val, (byte, index)| val | (byte << (index * 8)) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fernet-2.0.rc1 | lib/fernet/bit_packing.rb |