Пример #1
0
 /**
  * Prepare data to be sent
  *
  * @param   org.nagios.nsca.NscaMessage message
  * @return  string
  */
 public function prepare(NscaMessage $message)
 {
     // Calculate CRC32 checksum, then build the final packet with the sig
     // and encrypt it using defined crypt method
     return $this->encrypt($this->pack(CRC32::fromString($this->pack(0, $message))->asInt32(), $message));
 }
 /**
  * Returns a checksum for a given input string
  *
  * @param   string data
  * @return  security.checksum.Checksum
  */
 protected function checksumOf($data)
 {
     return CRC32::fromString($data)->getValue();
 }
Пример #3
0
 /**
  * Create a new checksum from a file object
  *
  * @param   io.File file
  * @return  security.checksum.CRC32
  */
 public static function fromFile($file)
 {
     return CRC32::fromString(FileUtil::getContents($file));
 }