本文整理汇总了C++中BigInteger::loadFromMemoryBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ BigInteger::loadFromMemoryBlock方法的具体用法?C++ BigInteger::loadFromMemoryBlock怎么用?C++ BigInteger::loadFromMemoryBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BigInteger
的用法示例。
在下文中一共展示了BigInteger::loadFromMemoryBlock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encryptXML
//==============================================================================
static String encryptXML (const XmlElement& xml, RSAKey privateKey)
{
MemoryOutputStream text;
text << xml.createDocument (StringRef(), true);
BigInteger val;
val.loadFromMemoryBlock (text.getMemoryBlock());
privateKey.applyToValue (val);
return val.toString (16);
}
示例2: encrypt
String EncryptedString::encrypt (const String& stringToEncrypt, const String& publicKey, bool resultAsHex)
{
RSAKey rsaKey (publicKey);
CharPointer_UTF8 stringPointer (stringToEncrypt.toUTF8());
MemoryBlock stringMemoryBlock (stringPointer.getAddress(), stringPointer.sizeInBytes());
BigInteger stringAsData;
stringAsData.loadFromMemoryBlock (stringMemoryBlock);
rsaKey.applyToValue (stringAsData);
if (resultAsHex)
{
MemoryBlock encryptedMemoryBlock (stringAsData.toMemoryBlock());
return String::toHexString ((char*) encryptedMemoryBlock.getData(), (int) encryptedMemoryBlock.getSize(), 0);
}
else
{
return stringAsData.toMemoryBlock().toBase64Encoding();
}
}
示例3: decrypt
String EncryptedString::decrypt (const String& encryptedString, const String& privateKey, bool inputIsHex)
{
RSAKey rsaKey (privateKey);
MemoryBlock encryptedMemoryBlock;
if (inputIsHex)
{
encryptedMemoryBlock.loadFromHexString (encryptedString);
}
else
{
encryptedMemoryBlock.fromBase64Encoding (encryptedString);
}
BigInteger stringAsData;
stringAsData.loadFromMemoryBlock (encryptedMemoryBlock);
rsaKey.applyToValue (stringAsData);
return stringAsData.toMemoryBlock().toString();
}
示例4: jojo_bang
void jojo_bang (t_jojo *x)
{
const ScopedLock myLock (x->lock_);
post ("Public / %s", x->public_.toString().toRawUTF8());
post ("Private / %s", x->private_.toString().toRawUTF8());
String myText (CharPointer_UTF8 ("P\xc3\xa9p\xc3\xa9 p\xc3\xa8te en ao\xc3\xbbt!"));
post ("%s", myText.toRawUTF8());
const juce::MemoryBlock blockBegin (myText.toRawUTF8(), myText.getNumBytesAsUTF8() + 1);
BigInteger bitArray;
bitArray.loadFromMemoryBlock (blockBegin);
x->public_.applyToValue (bitArray); /* Encrypt with the public key. */
post ("%s", bitArray.toString (16).toRawUTF8());
x->private_.applyToValue (bitArray); /* Then decrypt with the private key. */
const juce::MemoryBlock blockEnd (bitArray.toMemoryBlock());
post ("%s", blockEnd.toString().toRawUTF8());
}