You are here

public static function MobileNumber::codeHash in Mobile Number 7

Generate hash given token and code.

Parameters

string $token: Token.

string $code: Verification code.

string $number: Phone number.

Return value

string Hash string.

Overrides MobileNumberInterface::codeHash

3 calls to MobileNumber::codeHash()
MobileNumber::registerVerificationCode in src/MobileNumber.php
Registers code for mobile number and returns it's token.
MobileNumber::verifyCode in src/MobileNumber.php
Verifies input code matches code sent to user.
MobileNumberClassTestCase::testFunctions in tests/mobile_number.class.test
Test functions.

File

src/MobileNumber.php, line 297

Class

MobileNumber
Class MobileNumber handles mobile number validation and verification.

Code

public static function codeHash($token, $code, $number) {
  $secret = variable_get('mobile_number_secret', '');
  return sha1("{$number}{$secret}{$token}{$code}");
}