Sha256: ca779f4d26ed83bbaeb85eb519ea686c53b25812ba543c18c4ed06a0c910d396

Contents?: true

Size: 420 Bytes

Versions: 8

Compression:

Stored size: 420 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)
      end
      hashes
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
google_safe_browsing-0.6.5 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.6.4 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.6.3 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.6.2 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.6.1 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.6.0 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.5.1 lib/google_safe_browsing/hash_helper.rb
google_safe_browsing-0.5.0 lib/google_safe_browsing/hash_helper.rb