Class: EzCrypto::Digester

### Home Classes Methods

### In Files

- lib/ezcrypto.rb

### Parent

Object

### Methods

- ::digest
- ::digest64
- ::generate_hexkey
- ::generate_key
- ::generate_key64
- ::get_key
- ::hexdigest

### Files

- CHANGELOG
- README.rdoc
- README_ACTIVE_CRYPTO
- README_DIGITAL_SIGNATURES

### Class/Module Index

Quicksearch

- EzCrypto
- EzCrypto::Certificate
- EzCrypto::Digester
- EzCrypto::Key
- EzCrypto::Name
- EzCrypto::Signer
- EzCrypto::TrustStore
- EzCrypto::Verifier
- ActiveCrypto
- ActiveCrypto::AssociationKeyHolder
- ActiveCrypto::ClassMethods
- ActiveCrypto::Encrypted
- ActiveCrypto::Encrypted::ClassAccessors
- ActiveCrypto::KeyHolder
- ActiveCrypto::MissingKeyError

No matching classes.

# EzCrypto::Digester

### Public Class Methods

digest(data,size=16) click to toggle source

    # File lib/ezcrypto.rb, line 579
    def self.digest(data,size=16)
      if size==0
        ""
      elsif size<=16
        Digest::SHA1.digest(data)[0..(size-1)]
      else
        Digest::SHA256.digest(data)[0..(size-1)]
      end
    end

digest64(data,size=16) click to toggle source

    # File lib/ezcrypto.rb, line 605
    def self.digest64(data,size=16)
      Base64.encode64(digest(data,size))
    end

generate_hexkey(size=40) click to toggle source

    # File lib/ezcrypto.rb, line 571
    def self.generate_hexkey(size=40)
        key=OpenSSL::Random.random_bytes(size)
        hexdigest(key,size)
    end

generate_key(size=16) click to toggle source

    # File lib/ezcrypto.rb, line 556
    def self.generate_key(size=16)
        key=OpenSSL::Random.random_bytes(size)
        digest(key,size)
    end

generate_key64(size=32) click to toggle source

    # File lib/ezcrypto.rb, line 564
    def self.generate_key64(size=32)
        key=OpenSSL::Random.random_bytes(size)
        digest64(key,size)
    end

get_key(password,salt,size) click to toggle source

Various handy Digest methods.

Warning! The interface may change.

    # File lib/ezcrypto.rb, line 549
    def self.get_key(password,salt,size)
        digest(salt+password,size)
    end

hexdigest(data,size=40) click to toggle source

    # File lib/ezcrypto.rb, line 592
    def self.hexdigest(data,size=40)
      if size==0
        ""
      elsif size<=40
        Digest::SHA1.hexdigest(data)[0..(size-1)]
      else
        Digest::SHA256.hexdigest(data)[0..(size-1)]
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.