class RbNaCl::OneTimeAuths::Poly1305
Computes an authenticator using poly1305
The authenticator can be used at a later time to verify the provenance of the message by recomputing the tag over the message and then comparing it to the provided authenticator. The class provides methods for generating signatures and also has a constant-time implementation for checking them.
As the name suggests, this is a **ONE TIME** authenticator. Computing an authenticator for two messages using the same key probably gives an attacker enough information to forge further authenticators for the same key.
This is a secret key authenticator, i.e. anyone who can verify signatures can also create them.
Private Instance Methods
compute_authenticator(authenticator, message)
click to toggle source
# File lib/rbnacl/one_time_auths/poly1305.rb, line 40 def compute_authenticator(authenticator, message) self.class.onetimeauth_poly1305(authenticator, message, message.bytesize, key) end
verify_message(authenticator, message)
click to toggle source
# File lib/rbnacl/one_time_auths/poly1305.rb, line 44 def verify_message(authenticator, message) self.class.onetimeauth_poly1305_verify(authenticator, message, message.bytesize, key) end