Skip to content

Commit

Permalink
fix Bytes signatures. Byte is a span-type, it should be passed by value
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn authored and UdjinM6 committed Sep 6, 2022
1 parent 78b5fb5 commit 7089a38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ G1Element G1Element::FromMessage(const std::vector<uint8_t>& message,
return FromMessage(Bytes(message), dst, dst_len);
}

G1Element G1Element::FromMessage(const Bytes& message,
G1Element G1Element::FromMessage(Bytes const message,
const uint8_t* dst,
int dst_len)
{
Expand Down Expand Up @@ -315,7 +315,7 @@ G2Element G2Element::FromMessage(const std::vector<uint8_t>& message,
return FromMessage(Bytes(message), dst, dst_len, fLegacy);
}

G2Element G2Element::FromMessage(const Bytes& message,
G2Element G2Element::FromMessage(Bytes const message,
const uint8_t* dst,
int dst_len,
const bool fLegacy)
Expand Down Expand Up @@ -448,7 +448,7 @@ G2Element operator*(const bn_t& k, const G2Element& a) { return a * k; }

const size_t GTElement::SIZE;

GTElement GTElement::FromBytes(const Bytes& bytes)
GTElement GTElement::FromBytes(Bytes const bytes)
{
if (bytes.size() != SIZE) {
throw std::invalid_argument("GTElement::FromBytes: Invalid size");
Expand Down
6 changes: 3 additions & 3 deletions src/elements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class G1Element {
static G1Element FromMessage(const std::vector<uint8_t> &message,
const uint8_t *dst,
int dst_len);
static G1Element FromMessage(const Bytes& message,
static G1Element FromMessage(Bytes message,
const uint8_t* dst,
int dst_len);
static G1Element Generator();
Expand Down Expand Up @@ -89,7 +89,7 @@ class G2Element {
const uint8_t* dst,
int dst_len,
bool fLegacy = false);
static G2Element FromMessage(const Bytes& message,
static G2Element FromMessage(Bytes message,
const uint8_t* dst,
int dst_len,
bool fLegacy = false);
Expand Down Expand Up @@ -117,7 +117,7 @@ class G2Element {
class GTElement {
public:
static const size_t SIZE = 384;
static GTElement FromBytes(const Bytes& bytes);
static GTElement FromBytes(Bytes bytes);
static GTElement FromByteVector(const std::vector<uint8_t> &bytevec);
static GTElement FromNative(const gt_t *element);
static GTElement Unity(); // unity
Expand Down

0 comments on commit 7089a38

Please sign in to comment.