32 lines
710 B
Diff
32 lines
710 B
Diff
--- a/oqsphp.i
|
|
+++ b/oqsphp.i
|
|
@@ -25,6 +25,7 @@
|
|
%module(directors="1") oqsphp
|
|
%{
|
|
#include "oqs/oqs.h"
|
|
+#include "oqs/sha3.h"
|
|
#include <string>
|
|
#include <stdexcept>
|
|
#include <exception>
|
|
@@ -39,6 +40,20 @@
|
|
%feature("director");
|
|
%feature("php:type", "1");
|
|
|
|
+%inline %{
|
|
+std::string contractless_shake256(const std::string &input, size_t output_length) {
|
|
+ std::string output;
|
|
+ output.resize(output_length);
|
|
+ OQS_SHA3_shake256(
|
|
+ reinterpret_cast<uint8_t *>(output.data()),
|
|
+ output_length,
|
|
+ reinterpret_cast<const uint8_t *>(input.data()),
|
|
+ input.length()
|
|
+ );
|
|
+ return output;
|
|
+}
|
|
+%}
|
|
+
|
|
%inline %{
|
|
class CustomException : public std::exception {
|
|
public:
|