2017 © Pedro Peláez
 

library crypter

Simple tool for encrypting/decrypting a string. It based upon system ID.

image

rikby/crypter

Simple tool for encrypting/decrypting a string. It based upon system ID.

  • Monday, August 22, 2016
  • by andkirby
  • Repository
  • 1 Watchers
  • 1 Stars
  • 30 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

String Crypter

Simple tool for encrypting/decrypting a string. It based upon system ID., (*1)

$ composer require rikby/crypter

Using example:, (*2)

/**
 * Class Password
 */
class Password extends Crypter implements CrypterInterface
{
    /**
     * Get password
     *
     * @param string $trackerType
     * @return null|string
     * @throws \Exception
     */
    public function getPassword($trackerType)
    {
        try {
            //get saved encrypted password
            $password = SomeClass::getPostPassword();
            if (!$password) {
                return null;
            }

            return $this->decrypt($password) ?: null;
        } catch (\Exception $e) {
            throw new UserException('Cannot get password of tracker.', 0, $e);
        }
    }

    /**
     * Replace strange \000 character
     *
     * {@inheritdoc}
     */
    public function decrypt($string, $key = null)
    {
        $password = parent::decrypt($string, $key);

        /**
         * Unknown bug in PhpStorm
         * Only PHPStorm adds \0 to the tail of password
         * Perhaps PHP versions conflict
         */
        return rtrim($password, "\000");
    }
}

The Versions

22/08 2016

dev-master

9999999-dev

Simple tool for encrypting/decrypting a string. It based upon system ID.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

22/08 2016

1.0.0

1.0.0.0

Simple tool for encrypting/decrypting a string. It based upon system ID.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4