Esempio n. 1
0
 /**
  * @dataProvider encryptedWords
  */
 public function testEncrypt($in, $out)
 {
     $primeNumber = Math\Calculator::generateNthPrime(10000);
     $fibonacciSum = Math\Calculator::sumOfFibonacciElements(49);
     $tmp = gmp_strval(gmp_add($primeNumber, $fibonacciSum));
     $key = intval(strrev(substr($tmp, 5, -4)));
     $this->assertEquals($out, self::$cipher->encrypt($in, $key));
 }
Esempio n. 2
0
 /**
  * @dataProvider sumOfNthFirstElementsOfFibonacci
  */
 public function testSumOfNthFirstElementsOfFibonacci($index, $value)
 {
     $result = Math\Calculator::sumOfFibonacciElements($index);
     $this->assertInstanceOf('GMP', $result);
     $this->assertEquals(gmp_strval(gmp_init($value)), gmp_strval($result));
 }
Esempio n. 3
0
<?php

include_once 'vendor/autoload.php';
echo "The 10001th prime is: " . gmp_strval(Math\Calculator::generateNthPrime(10000)) . "\n";
echo "The sum of 50th first fibonacci numbers is: " . gmp_strval(Math\Calculator::sumOfFibonacciElements(49)) . "\n";
$cipher = new Crypto\Cipher(new Crypto\Relation(range('a', 'z'), range(1, 26)));
echo "The e-mail is: " . $cipher->encrypt('*****@*****.**', 11) . "\n";