/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <string.h>
#include <jni.h>
/* This is a trivial JNI example where we use a native method
* to return a new VM String. See the corresponding Java source
* file located at:
*
* apps/samples/hello-jni/project/src/com/example/hellojni/HelloJni.java
*/
void function(char name[])
{
char key[]="0123456789";
int CaseNum,i=0;
while(name[i])
{
name[i]=name[i]>>2;
CaseNum=name[i]%10;
switch (CaseNum)
{
case 0: name[i]=key[0];
break;
case 1: name[i]=key[1];
break;
case 2: name[i]=key[2];
break;
case 3: name[i]=key[3];
break;
case 4: name[i]=key[4];
break;
case 5: name[i]=key[5];
break;
case 6: name[i]=key[6];
break;
case 7: name[i]=key[7];
break;
case 8: name[i]=key[8];
break;
case 9: name[i]=key[9];
break;
default:name[i]='x';
break;
}
name[i]=name[i]<<1;
i++;
}
}
jstring
Java_com_example_hehe_MainActivity_stringFromJNI( JNIEnv* env,
jobject thiz )
{
char name[]="www.pediy.com";
int hash[]={0x10,0x12,0x14,0x46,0x18,0x1a,0x1c,0x1f,0x21,0x53,0x25,0x27,0x29};
int data[13]={0x13,0x15,0x15,0x48,0x4,0x11,0x7,0xa,0x7,0x40,0x9,0x5,0x5};
int i,length;
length=strlen(name);
for(i=0;i<length;i++)
{
name[i]^=hash[i];
name[i]-=20;
if(name[i]%2==0)
{
name[i]+=10;
}
else
name[i]+=5;
}
function(name);
for(i=0;i<length;i++)
name[i]^=data[i];
return (*env)->NewStringUTF(env, name);
}
jni.zip_Go_ Go_ Go!_jni
版权申诉
66 浏览量
2022-09-24
06:30:00
上传
评论
收藏 2KB ZIP 举报
寒泊
- 粉丝: 75
- 资源: 1万+
最新资源
- keil2 + proteus + 8051.exe
- 1961ee27df03bd4595d28e24b00dde4e_744c805f7e4fb4d40fa3f695bfbab035_8(1).c
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- windows注册表编辑工具
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- 校园通行码预约管理系统20240522075502
- 车类型数据集6250张VOC+YOLO格式.zip
- The PyTorch implementation of STGCN.STGCN-main.zip
- 092300108.cpp
- 车类型数据集6000张VOC+YOLO格式.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈