示例#1
0
 private function encodeTest($type, $data, $ecWords)
 {
     $field = GenericGF::getInstance($type);
     $encoder = new ReedSolomonEncoder($field);
     $messageExpected = array_merge($data, $ecWords);
     $paddedData = array_pad($data, count($data) + count($ecWords), 0);
     $result = $encoder->encode($data, count($ecWords));
     $this->assertEquals($messageExpected, $result);
     $resultPadded = $encoder->encodePadded($paddedData, count($ecWords));
     $this->assertEquals($messageExpected, $resultPadded);
 }
示例#2
0
文件: Encoder.php 项目: kedarv/metzli
 private static function getGF($wordSize)
 {
     switch ($wordSize) {
         case 4:
             return GenericGF::getInstance(GenericGF::AZTEC_PARAM);
         case 6:
             return GenericGF::getInstance(GenericGF::AZTEC_DATA_6);
         case 8:
             return GenericGF::getInstance(GenericGF::AZTEC_DATA_8);
         case 10:
             return GenericGF::getInstance(GenericGF::AZTEC_DATA_10);
         case 12:
             return GenericGF::getInstance(GenericGF::AZTEC_DATA_12);
         default:
             return null;
     }
 }