app/models/unidom/common/concerns/sha384_digester.rb in unidom-common-1.9.2 vs app/models/unidom/common/concerns/sha384_digester.rb in unidom-common-1.10

- old
+ new

@@ -5,13 +5,33 @@ extend ActiveSupport::Concern included do |includer| + ## + # 对明文 message 进行 SHA-384 摘要, pepper 是用于增加混乱的内容。如: + # class SomeModel + # include Unidom::Common::Concerns::Sha384Digester + # def some_method(param_1) + # digest param_1 + # # 或者 + # digest param_1, pepper: 'my_pepper' + # end + # end def digest(message, pepper: nil) self.class.digest message, pepper: pepper end + ## + # 对明文 message 进行 SHA-384 摘要,并以16进制的形式返回, pepper 是用于增加混乱的内容。如: + # class SomeModel + # include Unidom::Common::Concerns::Sha384Digester + # def some_method(param_1) + # hex_digest param_1 + # # 或者 + # hex_digest param_1, pepper: 'my_pepper' + # end + # end def hex_digest(message, pepper: nil) self.class.hex_digest message, pepper: pepper end end