lib/zold/signature.rb in zold-0.2 vs lib/zold/signature.rb in zold-0.3
- old
+ new
@@ -17,32 +17,32 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
require 'time'
-require_relative 'key.rb'
-require_relative 'id.rb'
-require_relative 'amount.rb'
+require_relative 'key'
+require_relative 'id'
+require_relative 'amount'
# The signature of a transaction.
#
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2018 Yegor Bugayenko
# License:: MIT
module Zold
# A signature
class Signature
- def sign(pvt, txn)
- pvt.sign(block(txn))
+ def sign(pvt, t)
+ pvt.sign(block(t))
end
- def valid?(pub, txn)
- pub.verify(txn[:sign], block(txn))
+ def valid?(pub, t)
+ pub.verify(t.sign, block(t))
end
private
- def block(txn)
- "#{txn[:id]};#{txn[:amount].to_i};#{txn[:bnf]};#{txn[:details]}"
+ def block(t)
+ [t.id, t.amount.to_i, t.prefix, t.bnf, t.details].join(';')
end
end
end