From b785a1a76e0863fc98d0acc98a098d328929d493 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 8 Apr 2019 20:37:26 +0100 Subject: Make Key support any length. --- src/key.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/key.h') diff --git a/src/key.h b/src/key.h index c1402c54..0464296f 100644 --- a/src/key.h +++ b/src/key.h @@ -38,6 +38,7 @@ #ifndef LIBDCP_KEY_H #define LIBDCP_KEY_H +#include #include #include @@ -50,10 +51,10 @@ class Key { public: /** Create a new, random key */ - Key (); + Key (int length = ASDCP::KeyLen); /** Create a Key from a raw key value */ - explicit Key (uint8_t const *); + explicit Key (uint8_t const *, int length = ASDCP::KeyLen); /** Create a Key from a hex key value */ explicit Key (std::string); @@ -68,12 +69,17 @@ public: return _value; } + int length () const { + return _length; + } + /** @return Key value as a hexadecimal string */ std::string hex () const; private: /** Raw key value */ uint8_t* _value; + int _length; }; extern bool operator== (Key const & a, Key const & b); -- cgit v1.2.3