示例#1
0
/*@-protoparammatch@*/
int md4Digest(md4Param* mp, byte* data)
{
    md4Finish(mp);

    /* encode 4 integers little-endian style */
    data[ 0] = (byte)(mp->h[0]      );
    data[ 1] = (byte)(mp->h[0] >>  8);
    data[ 2] = (byte)(mp->h[0] >> 16);
    data[ 3] = (byte)(mp->h[0] >> 24);
    data[ 4] = (byte)(mp->h[1]      );
    data[ 5] = (byte)(mp->h[1] >>  8);
    data[ 6] = (byte)(mp->h[1] >> 16);
    data[ 7] = (byte)(mp->h[1] >> 24);
    data[ 8] = (byte)(mp->h[2]      );
    data[ 9] = (byte)(mp->h[2] >>  8);
    data[10] = (byte)(mp->h[2] >> 16);
    data[11] = (byte)(mp->h[2] >> 24);
    data[12] = (byte)(mp->h[3]      );
    data[13] = (byte)(mp->h[3] >>  8);
    data[14] = (byte)(mp->h[3] >> 16);
    data[15] = (byte)(mp->h[3] >> 24);

    (void) md4Reset(mp);
    return 0;
}
jlong JNICALL Java_beecrypt_provider_MD4_allocParam(JNIEnv* env, jclass dummy)
{
	jlong param = (jlong) malloc(sizeof(md4Param));
	if (param == 0)
	{
		jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError");
		if (ex)
			(*env)->ThrowNew(env, ex, (const char*) 0);
	}

	md4Reset((md4Param*) param);

	return param;
}
void JNICALL Java_beecrypt_provider_MD4_reset(JNIEnv* env, jclass dummy, jlong param)
{
	md4Reset((md4Param*) param);
}