Class: Win32::Certstore::Mixin::Crypto::CRYPT_HASH_BLOB
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Win32::Certstore::Mixin::Crypto::CRYPT_HASH_BLOB
- Defined in:
- lib/win32/certstore/mixin/crypto.rb
Instance Method Summary collapse
-
#initialize(str = nil) ⇒ CRYPT_HASH_BLOB
constructor
A new instance of CRYPT_HASH_BLOB.
Constructor Details
#initialize(str = nil) ⇒ CRYPT_HASH_BLOB
Returns a new instance of CRYPT_HASH_BLOB.
142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/win32/certstore/mixin/crypto.rb', line 142 def initialize(str = nil) super(nil) if str byte_arr = [str].pack("H*").unpack("C*") # Converting string to its byte array buffer = FFI::MemoryPointer.new(:char, byte_arr.size) # Create the pointer to the array buffer.put_array_of_char 0, byte_arr # Fill the memory location with data self[:pbData] = buffer self[:cbData] = byte_arr.size end end |