The code is as follows:
return env->NewStringUTF((const char*)digest);
On the statement VM Aborts.
where digest is and unsigned char which has a hashed characters. I logged digest variable and it showed some ascii values. Probably after hashing it mush have got few characters like that.
My Function is as follows:
- Code: Select all
typedef unsigned char BYTE ;
unsigned char *test = (unsigned char *)"Hi There" ;
BYTE Key ;
BYTE digest ;
jstring Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, jobject thiz )
memset(Key, 0x0b, 20) ;
////////Next 2 lines are for Hashing the given text
CHMAC_SHA1 HMAC_SHA1 ;
HMAC_SHA1.HMAC_SHA1(test, strlen((const char *)test), Key, sizeof(Key), digest) ;
__android_log_write(ANDROID_LOG_ERROR,"Hello-Sample",(const char *)digest);
jstring temp = env->NewStringUTF((const char*)digest);
Can someone please tell me what can be the problem and how to rectify it?