I would try DataMapper's Binary
type:
class MyRecord
include DataMapper::Resource
property :id, Serial
property :amount, Binary, length: 64
end
Another approach would be to base64 encode the digest and store it as a string:
class MyRecord
include DataMapper::Resource
property :id, Serial
property :amount, String, length: 88
end
and then:
require 'base64'
x = OpenSSL::Digest::SHA512.new('test').digest
x = Base64.strict_encode64(x)
y = MyRecord.new
y.amount = x
y.save