Product SiteDocumentation Site

Chapter 2. Core Packages

2.1. The Crypt Package
2.1.1. JCryptPassword
2.1.2. JCryptPasswordSimple
2.2. The Database Package
2.2.1. Introduction
2.2.2. Iterating on results
2.3. The Github Package
2.3.1. Using the Github Package
2.4. The Google Package
2.4.1. Using the Google Package
2.5. The HTTP Package
2.5.1. JHttpFactory
2.5.2. JHttp
2.5.3. JHttpResponse
2.5.4. JHttpTransport
2.5.5. JHttpTransportCurl
2.5.6. JHttpTransportSocket
2.5.7. JHttpTransportStream
2.6. The Input Package
2.6.1. JInput
2.6.2. JInputCli
2.6.3. JInputCookie
2.6.4. JInputFiles
2.7. The Keychain Package
2.7.1. Key Storage
2.7.2. JKeychain
2.7.3. Keychain Management Utility
2.8. The Log Package
2.8.1. Introduction
2.8.2. Logging priority
2.8.3. Logging to files (formattedtext)
2.8.4. Logging to the database
2.9. The Model-View-Controller Packages
2.9.1. Introduction
2.9.2. JController
2.9.3. JControllerBase
2.9.4. JModel
2.9.5. JModelBase
2.9.6. JModelDatabase
2.9.7. JView
2.9.8. JViewBase
2.9.9. JViewHtml
This is information about the core platform packages.

2.1. The Crypt Package

The Crypt password provides a set of classes that can be used for encrypting and hashing data.

2.1.1. JCryptPassword

JCryptPassword is an interface that requires a class to be implemented with a create and a verify method.
The create method should take a plain text password and a type and return a hashed password.
The verify method should accept a plain text password and a hashed password and return a boolean indicating whether or not the password matched the password in the hash.
The JCryptPassword interface defines the following constants for use with implementations:
  • JCryptPassword::BLOWFISH
  • JCryptPassword::JOOMLA
  • JCryptPassword::MD5

2.1.2. JCryptPasswordSimple Usage

In addition to the interface JCryptPassword there is also a basic implementation provided which provides for use with the most common password schemes. This if found in the JCryptPasswordSimple class.
Aside from the two methods create and verify methods, this implementation also adds an additional method called setCost. This method is used to set a cost parameter for methods that support workload factors. It takes an integer cost factor as a parameter.
JCryptPasswordSimple provides support for bcrypt, MD5 and the traditional Joomla! CMS hashing scheme. The hash format can be specified during hash creation by using the constants JCryptPassword::BLOWFISH, JCryptPassword::MD5 and JCryptPassword::JOOMLA. An appropriate salt will be automatically generated when required.