Note that there are some explanatory texts on larger screens.

plurals
  1. POCrypto++ causing application failure
    primarykey
    data
    text
    <p>I am developing an AIR Native Extension of Crypto++ for Flash which I will release as public domain. I started with some code to test hashing (with SHA-256 in this case) but for some reason <code>CryptoPP::SHA256().CalculateDigest(abDigest, pbData, nDataLen);</code> (as discovered by the process of elimination) causes the Flash compiler to not recognize any available methods (The extension context does not have a method with the name isSupported.):</p> <p>Here's the full C++ code:</p> <pre><code>FREObject isSupported(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) { FREObject result; uint32_t isSupportedSwitch = 1; FRENewObjectFromBool(isSupportedSwitch, &amp;result); return result; } FREObject computeHash(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) { FREObject result; FREByteArray actualBytes; FREAcquireByteArray(argv[0], &amp;actualBytes); byte const* pbData = (byte*) actualBytes.bytes; unsigned int nDataLen = strlen((const char*) pbData); byte abDigest[CryptoPP::SHA256::DIGESTSIZE]; CryptoPP::SHA256().CalculateDigest(abDigest, pbData, nDataLen); memcpy(actualBytes.bytes, (uint8_t*) abDigest, 32); FREReleaseByteArray(argv[0]); FRENewObjectFromBool(1, &amp;result); return result; } void testContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctions, const FRENamedFunction** functions) { *numFunctions = 2; FRENamedFunction* func = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * (*numFunctions)); func[0].name = (const uint8_t*) "isSupported"; func[0].functionData = NULL; func[0].function = &amp;isSupported; func[1].name = (const uint8_t*) "computeHash"; func[1].functionData = NULL; func[1].function = &amp;computeHash; *functions = func; } void testContextFinalizer(FREContext ctx) { return; } void testInitializer(void** extData, FREContextInitializer* ctxInitializer, FREContextFinalizer* ctxFinalizer) { *ctxInitializer = &amp;testContextInitializer; *ctxFinalizer = &amp;testContextFinalizer; } void testFinalizer(void* extData) { return; } </code></pre> <p>Any help on this would be deeply appreciated and would go a long way in helping me in this project.</p> <p>EDIT: To clarify, I am asking why <code>CryptoPP::SHA256().CalculateDigest(abDigest, pbData, nDataLen);</code> causes the application failure mentioned above and possible ways to fix it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload