PresetCurve.php 588 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Elliptic\Curve;
  3. class PresetCurve
  4. {
  5. public $curve;
  6. public $g;
  7. public $n;
  8. public $hash;
  9. function __construct($options)
  10. {
  11. if ( $options["type"] === "short" )
  12. $this->curve = new ShortCurve($options);
  13. elseif ( $options["type"] === "edwards" )
  14. $this->curve = new EdwardsCurve($options);
  15. else
  16. $this->curve = new MontCurve($options);
  17. $this->g = $this->curve->g;
  18. $this->n = $this->curve->n;
  19. $this->hash = isset($options["hash"]) ? $options["hash"] : null;
  20. }
  21. }
  22. ?>