- Library code update

- project update (added Eigen)

git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@94 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2014-12-20 20:59:48 +00:00
parent 1b4d8e9f54
commit dc5560392f
312 changed files with 6349 additions and 4195 deletions
@@ -54,6 +54,11 @@ bool RSAKey::operator!= (const RSAKey& other) const noexcept
return ! operator== (other);
}
bool RSAKey::isValid() const noexcept
{
return operator!= (RSAKey());
}
String RSAKey::toString() const
{
return part1.toString (16) + "," + part2.toString (16);
@@ -32,6 +32,62 @@
An object of this type makes up one half of a public/private RSA key pair. Use the
createKeyPair() method to create a matching pair for encoding/decoding.
If you need to use this class in conjunction with a compatible enc/decryption
algorithm on a webserver, you can achieve the same thing in PHP like this:
@code
include ('Math/BigInteger.php'); // get this from: phpseclib.sourceforge.net
function applyToValue ($message, $key_part1, $key_part2)
{
$result = new Math_BigInteger();
$zero = new Math_BigInteger();
$value = new Math_BigInteger (strrev ($message), 256);
$part1 = new Math_BigInteger ($key_part1, 16);
$part2 = new Math_BigInteger ($key_part2, 16);
while (! $value->equals ($zero))
{
$result = $result->multiply ($part2);
list ($value, $remainder) = $value->divide ($part2);
$result = $result->add ($remainder->modPow ($part1, $part2));
}
return strrev ($result->toBytes());
}
@endcode
..or in Java with something like this:
@code
public class RSAKey
{
static BigInteger applyToValue (BigInteger value, String key_part1, String key_part2)
{
BigInteger result = BigInteger.ZERO;
BigInteger part1 = new BigInteger (key_part1, 16);
BigInteger part2 = new BigInteger (key_part2, 16);
if (part1.equals (BigInteger.ZERO) || part2.equals (BigInteger.ZERO)
|| value.compareTo (BigInteger.ZERO) <= 0)
return result;
while (! value.equals (BigInteger.ZERO))
{
result = result.multiply (part2);
BigInteger[] div = value.divideAndRemainder (part2);
value = div[0];
result = result.add (div[1].modPow (part1, part2));
}
return result;
}
}
@endcode
Disclaimer: neither of the code snippets above are tested! Please let me know if you have
any corrections for them!
*/
class JUCE_API RSAKey
{
@@ -57,11 +113,15 @@ public:
//==============================================================================
/** Turns the key into a string representation.
This can be reloaded using the constructor that takes a string.
*/
String toString() const;
/** Returns true if the object is a valid key, or false if it was created by
the default constructor.
*/
bool isValid() const noexcept;
//==============================================================================
/** Encodes or decodes a value.
@@ -44,14 +44,14 @@ public:
MD5() noexcept;
/** Creates a copy of another MD5. */
MD5 (const MD5& other) noexcept;
MD5 (const MD5&) noexcept;
/** Copies another MD5. */
MD5& operator= (const MD5& other) noexcept;
MD5& operator= (const MD5&) noexcept;
//==============================================================================
/** Creates a checksum for a block of binary data. */
explicit MD5 (const MemoryBlock& data) noexcept;
explicit MD5 (const MemoryBlock&) noexcept;
/** Creates a checksum for a block of binary data. */
MD5 (const void* data, size_t numBytes) noexcept;
@@ -64,10 +64,10 @@ public:
*/
MD5 (InputStream& input, int64 numBytesToRead = -1);
/** Creates a checksum for a file. */
explicit MD5 (const File& file);
/** Creates a checksum for the contents of a file. */
explicit MD5 (const File&);
/** Creates a checksum from a UTF-8 buffer.
/** Creates a checksum of the characters in a UTF-8 buffer.
E.g.
@code MD5 checksum (myString.toUTF8());
@endcode
@@ -108,6 +108,10 @@ private:
void processData (const void*, size_t) noexcept;
void processStream (InputStream&, int64);
// This private constructor is declared here to prevent you accidentally passing a
// String and having it unexpectedly call the constructor that takes a File.
explicit MD5 (const String&) JUCE_DELETED_FUNCTION;
JUCE_LEAK_DETECTOR (MD5)
};
@@ -1,7 +1,7 @@
{
"id": "juce_cryptography",
"name": "JUCE cryptography classes",
"version": "3.0.5",
"version": "3.0.8",
"description": "Classes for various basic cryptography functions, including RSA, Blowfish, MD5, SHA, etc.",
"website": "http://www.juce.com/juce",
"license": "GPL/Commercial",