Sha256: 7e2823aa610f5840290f415e6905e2f320289b4d745b569292585d90c30c300d

Contents?: true

Size: 452 Bytes

Versions: 15

Compression:

Stored size: 452 Bytes

Contents

module GoogleSafeBrowsing
  class HashHelper

    class GsbHash
      def initialize(hash)
        @hash = hash
      end

      def prefix
        @hash[0..7]
      end

      def to_s
        @hash
      end

    end

    def self.urls_to_hashes(urls)
      hashes = []
      urls.each do |u|
        hash = ( Digest::SHA256.new << u ).to_s
        hashes << GsbHash.new(hash)
        #puts "#{u} -- #{hash}"
      end
      hashes
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
google_safe_browsing-0.4.2 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.4.1 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.4.0 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.9 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.8 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.7 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.6 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.5 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.4 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.3 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.2 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.1 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.3.0 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.2.0 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.1.0 lib/google_safe_browsing/hash_helper.rb