<commit_before>module Alipay
  module Open
    module Sign
    
      def self.generate(params)
        for_sign_string = Utils.stringify_keys_with_hash_value(params)

        puts "++++ String Params = #{for_sign_string}"

        #读取私钥文件
        rsa_private_key_file = File.read(Alipay.rsa_private_key_file)
        #转换为openssl密钥
        openssl_key = OpenSSL::PKey::RSA.new rsa_private_key_file
        #使用openssl方法进行sha1签名digest(不能用sha256)
        digest = OpenSSL::Digest::SHA1.new
        signature = openssl_key.sign digest, for_sign_string
        #base64编码
        signature = Base64.encode64(signature)
        return signature.gsub("\n","")
      end

    end<commit_msg>openssl<commit_after>module Alipay
  module Open
    module Sign
    
      def self.generate(params)
        for_sign_string = Utils.stringify_keys_with_hash_value(params)

        puts "++++ String Params = #{for_sign_string}"

        #读取私钥文件
        rsa_private_key_file = File.read(Alipay.rsa_private_key_file)
        #转换为openssl密钥
        openssl_key = OpenSSL::PKey::RSA.new rsa_private_key_file

        puts " +++++ Openssl Key = #{openssl_key}"
        #使用openssl方法进行sha1签名digest(不能用sha256)
        digest = OpenSSL::Digest::SHA1.new
        signature = openssl_key.sign digest, for_sign_string
        #base64编码
        signature = Base64.encode64(signature)
        return signature.gsub("\n","")
      end

    end
{'fraction_non_alphanumeric': 0.09148936170212765, 'fraction_numerical': 0.015602836879432624, 'mean_word_length': 2.7828418230563003, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6402169', 'n_tokens_mistral': 502, 'n_tokens_neox': 489, 'n_words': 73}