hashsum 1.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hashsum.rb +25 -3
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e6b4928f36a1a467e5368121c6f2e0f0bb2bc694
         | 
| 4 | 
            +
              data.tar.gz: 347db93ff2694d76cdc6d02c7c9c541a3cec26f0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f8cc9e48434aa9f45c417581ece13c491beeb4f153ca4e66251f314e4eb9436aaae90285edf0ca6dbbe93f421b0ad1eac070217e95f4dd90958a9f64748c2046
         | 
| 7 | 
            +
              data.tar.gz: 763ebddbdd9f2e85b92b7f05d8b8434cf7ccd886173522e836cedd8617c61a89e887abb72251c288147374c39fc07a6ba175200c31c9cf4c2e83375ffa9dd3a3
         | 
    
        data/lib/hashsum.rb
    CHANGED
    
    | @@ -1,11 +1,33 @@ | |
| 1 1 | 
             
            class String
         | 
| 2 | 
            +
              # Algorithms
         | 
| 3 | 
            +
              HASH = {
         | 
| 4 | 
            +
                md5:    Digest::MD5,
         | 
| 5 | 
            +
                sha1:   Digest::SHA1,
         | 
| 6 | 
            +
                sha2:   Digest::SHA2,
         | 
| 7 | 
            +
                sha256: Digest::SHA256,
         | 
| 8 | 
            +
                sha384: Digest::SHA348,
         | 
| 9 | 
            +
                sha512: Digest::SHA512
         | 
| 10 | 
            +
              }
         | 
| 11 | 
            +
              def hashsum(hash, salt = "")
         | 
| 12 | 
            +
                require 'digest'
         | 
| 13 | 
            +
                HASH[hash].hexdigest(salt+self)
         | 
| 14 | 
            +
              end
         | 
| 2 15 | 
             
              def to_md5(salt = "")
         | 
| 3 | 
            -
                 | 
| 16 | 
            +
                hashsum(:md5, salt)
         | 
| 4 17 | 
             
              end
         | 
| 5 18 | 
             
              def to_sha1(salt = "")
         | 
| 6 | 
            -
                 | 
| 19 | 
            +
                hashsum(:sha1, salt)
         | 
| 7 20 | 
             
              end
         | 
| 8 21 | 
             
              def to_sha2(salt = "")
         | 
| 9 | 
            -
                 | 
| 22 | 
            +
                hashsum(:sha2, salt)
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
              def to_sha256(salt = "")
         | 
| 25 | 
            +
                hashsum(:sha256, salt)
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
              def to_sha384(salt = "")
         | 
| 28 | 
            +
                hashsum(:sha384, salt)
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
              def to_sha512(salt = "")
         | 
| 31 | 
            +
                hashsum(:sha512, salt)
         | 
| 10 32 | 
             
              end
         | 
| 11 33 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: hashsum
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0 | 
| 4 | 
            +
              version: 2.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Francesco Russo
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2013-09- | 
| 11 | 
            +
            date: 2013-09-17 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: Add hashing methods to String class
         | 
| 14 14 | 
             
            email: fraskyrusso@gmail.com
         | 
| @@ -17,7 +17,7 @@ extensions: [] | |
| 17 17 | 
             
            extra_rdoc_files: []
         | 
| 18 18 | 
             
            files:
         | 
| 19 19 | 
             
            - lib/hashsum.rb
         | 
| 20 | 
            -
            homepage: http:// | 
| 20 | 
            +
            homepage: http://github.com/fraskyrusso/hashsum
         | 
| 21 21 | 
             
            licenses:
         | 
| 22 22 | 
             
            - MIT
         | 
| 23 23 | 
             
            - GPL
         |