public
class
MainActivity
extends
Activity {
private
static
String path;
public
static
native
String verify(String str);
static
{
System.loadLibrary(
"crackme"
);
}
@Override
protected
void
onCreate(Bundle bundle) {
super
.onCreate(bundle);
setContentView(R.layout.activity_main);
if
(!Build.SUPPORTED_ABIS[
0
].equals(
"arm64-v8a"
)) {
Toast.makeText(
this
,
"Unsupported architecture"
,
0
).show();
finish();
}
try
{
InputStream open = getAssets().open(
"cm"
);
byte
[] bArr =
new
byte
[open.available()];
open.read(bArr);
open.close();
File file =
new
File(getFilesDir(),
"cm"
);
FileOutputStream fileOutputStream =
new
FileOutputStream(file);
fileOutputStream.write(bArr);
fileOutputStream.close();
path = file.getAbsolutePath();
}
catch
(IOException e) {
Toast.makeText(
this
, e.getMessage(),
0
).show();
finish();
}
}
public
void
submit(View view) {
Toast.makeText(
this
, verify(((EditText) findViewById(R.id.editText)).getText().toString()),
0
).show();
}
}