From a0e96814ff9bc7e6ccec36169c018d1d949f7984 Mon Sep 17 00:00:00 2001 From: Hamidreza Bayat Date: Fri, 25 Oct 2019 00:53:12 +0330 Subject: [PATCH] Add CRC tool --- .../app/src/main/AndroidManifest.xml | 4 + .../app/src/main/java/crccalc/AlgoParams.java | 88 ++++++++++++++++++ .../app/src/main/java/crccalc/Crc16.java | 57 ++++++++++++ .../app/src/main/java/crccalc/Crc32.java | 20 ++++ .../app/src/main/java/crccalc/Crc64.java | 12 +++ .../app/src/main/java/crccalc/Crc8.java | 21 +++++ .../src/main/java/crccalc/CrcCalculator.java | 91 +++++++++++++++++++ .../app/src/main/java/crccalc/CrcHelper.java | 20 ++++ .../app/src/main/java/crccalc/Main.java | 39 ++++++++ .../app/src/main/java/crccalc/license.txt | 21 +++++ .../MifareClassicTool/Activities/CrcCalc.java | 31 +++++++ .../Activities/MainMenu.java | 4 + .../src/main/res/layout/activity_crc_calc.xml | 20 ++++ .../app/src/main/res/menu/tools.xml | 2 + .../app/src/main/res/values/strings.xml | 2 + 15 files changed, 432 insertions(+) create mode 100644 Mifare Classic Tool/app/src/main/java/crccalc/AlgoParams.java create mode 100644 Mifare Classic Tool/app/src/main/java/crccalc/Crc16.java create mode 100644 Mifare Classic Tool/app/src/main/java/crccalc/Crc32.java create mode 100644 Mifare Classic Tool/app/src/main/java/crccalc/Crc64.java create mode 100644 Mifare Classic Tool/app/src/main/java/crccalc/Crc8.java create mode 100644 Mifare Classic Tool/app/src/main/java/crccalc/CrcCalculator.java create mode 100644 Mifare Classic Tool/app/src/main/java/crccalc/CrcHelper.java create mode 100644 Mifare Classic Tool/app/src/main/java/crccalc/Main.java create mode 100644 Mifare Classic Tool/app/src/main/java/crccalc/license.txt create mode 100644 Mifare Classic Tool/app/src/main/java/de/syss/MifareClassicTool/Activities/CrcCalc.java create mode 100644 Mifare Classic Tool/app/src/main/res/layout/activity_crc_calc.xml diff --git a/Mifare Classic Tool/app/src/main/AndroidManifest.xml b/Mifare Classic Tool/app/src/main/AndroidManifest.xml index e6f3b900..b3666716 100644 --- a/Mifare Classic Tool/app/src/main/AndroidManifest.xml +++ b/Mifare Classic Tool/app/src/main/AndroidManifest.xml @@ -179,6 +179,10 @@ android:icon="@drawable/clone_uid" android:label="@string/title_activity_clone_uid" > + + diff --git a/Mifare Classic Tool/app/src/main/java/crccalc/AlgoParams.java b/Mifare Classic Tool/app/src/main/java/crccalc/AlgoParams.java new file mode 100644 index 00000000..fb208011 --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/crccalc/AlgoParams.java @@ -0,0 +1,88 @@ +package crccalc; + +/** + * Created by anthony on 11.05.2017. + * https://github.com/meetanthony/crcjava + */ + public class AlgoParams + { + + public AlgoParams(String name, int hashSize, long poly, long init, boolean refIn, boolean refOut, long xorOut, long check) + { + Name = name; + Check = check; + Init = init; + Poly = poly; + RefIn = refIn; + RefOut = refOut; + XorOut = xorOut; + HashSize = hashSize; + } + + /// + /// This field is not strictly part of the definition, and, in + /// the event of an inconsistency between this field and the other + /// field, the other fields take precedence.This field is a check + /// value that can be used as a weak validator of implementations of + /// the algorithm.The field contains the checksum obtained when the + /// ASCII string "123456789" is fed through the specified algorithm + /// (i.e. 313233... (hexadecimal)). + /// + public long Check; + + /// + /// This is hash size. + /// + public int HashSize; + + /// + /// This parameter specifies the initial value of the register + /// when the algorithm starts.This is the value that is to be assigned + /// to the register in the direct table algorithm. In the table + /// algorithm, we may think of the register always commencing with the + /// value zero, and this value being XORed into the register after the + /// N'th bit iteration. This parameter should be specified as a + /// hexadecimal number. + /// + public long Init; + + /// + /// This is a name given to the algorithm. A string value. + /// + public String Name; + + /// + /// This parameter is the poly. This is a binary value that + /// should be specified as a hexadecimal number.The top bit of the + /// poly should be omitted.For example, if the poly is 10110, you + /// should specify 06. An important aspect of this parameter is that it + /// represents the unreflected poly; the bottom bit of this parameter + /// is always the LSB of the divisor during the division regardless of + /// whether the algorithm being modelled is reflected. + /// + public long Poly; + + /// + /// This is a boolean parameter. If it is FALSE, input bytes are + /// processed with bit 7 being treated as the most significant bit + /// (MSB) and bit 0 being treated as the least significant bit.If this + /// parameter is FALSE, each byte is reflected before being processed. + /// + public boolean RefIn; + + /// + /// This is a boolean parameter. If it is set to FALSE, the + /// final value in the register is fed into the XOROUT stage directly, + /// otherwise, if this parameter is TRUE, the final register value is + /// reflected first. + /// + public boolean RefOut; + + /// + /// This is an W-bit value that should be specified as a + /// hexadecimal number.It is XORed to the final register value (after + /// the REFOUT) stage before the value is returned as the official + /// checksum. + /// + public long XorOut; +} \ No newline at end of file diff --git a/Mifare Classic Tool/app/src/main/java/crccalc/Crc16.java b/Mifare Classic Tool/app/src/main/java/crccalc/Crc16.java new file mode 100644 index 00000000..e6773246 --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/crccalc/Crc16.java @@ -0,0 +1,57 @@ +package crccalc; + +/** + * Created by anthony on 15.05.2017. + */ +public class Crc16 { + public static AlgoParams Crc16CcittFalse = new AlgoParams("CRC-16/CCITT-FALSE", 16, 0x1021, 0xFFFF, false, false, 0x0, 0x29B1); + public static AlgoParams Crc16Arc = new AlgoParams("CRC-16/ARC", 16, 0x8005, 0x0, true, true, 0x0, 0xBB3D); + public static AlgoParams Crc16AugCcitt = new AlgoParams("CRC-16/AUG-CCITT", 16, 0x1021, 0x1D0F, false, false, 0x0, 0xE5CC); + public static AlgoParams Crc16Buypass = new AlgoParams("CRC-16/BUYPASS", 16, 0x8005, 0x0, false, false, 0x0, 0xFEE8); + public static AlgoParams Crc16Cdma2000 = new AlgoParams("CRC-16/CDMA2000", 16, 0xC867, 0xFFFF, false, false, 0x0, 0x4C06); + public static AlgoParams Crc16Dds110 = new AlgoParams("CRC-16/DDS-110", 16, 0x8005, 0x800D, false, false, 0x0, 0x9ECF); + public static AlgoParams Crc16DectR = new AlgoParams("CRC-16/DECT-R", 16, 0x589, 0x0, false, false, 0x1, 0x7E); + public static AlgoParams Crc16DectX = new AlgoParams("CRC-16/DECT-X", 16, 0x589, 0x0, false, false, 0x0, 0x7F); + public static AlgoParams Crc16Dnp = new AlgoParams("CRC-16/DNP", 16, 0x3D65, 0x0, true, true, 0xFFFF, 0xEA82); + public static AlgoParams Crc16En13757 = new AlgoParams("CRC-16/EN-13757", 16, 0x3D65, 0x0, false, false, 0xFFFF, 0xC2B7); + public static AlgoParams Crc16Genibus = new AlgoParams("CRC-16/GENIBUS", 16, 0x1021, 0xFFFF, false, false, 0xFFFF, 0xD64E); + public static AlgoParams Crc16Maxim = new AlgoParams("CRC-16/MAXIM", 16, 0x8005, 0x0, true, true, 0xFFFF, 0x44C2); + public static AlgoParams Crc16Mcrf4Xx = new AlgoParams("CRC-16/MCRF4XX", 16, 0x1021, 0xFFFF, true, true, 0x0, 0x6F91); + public static AlgoParams Crc16Riello = new AlgoParams("CRC-16/RIELLO", 16, 0x1021, 0xB2AA, true, true, 0x0, 0x63D0); + public static AlgoParams Crc16T10Dif = new AlgoParams("CRC-16/T10-DIF", 16, 0x8BB7, 0x0, false, false, 0x0, 0xD0DB); + public static AlgoParams Crc16Teledisk = new AlgoParams("CRC-16/TELEDISK", 16, 0xA097, 0x0, false, false, 0x0, 0xFB3); + public static AlgoParams Crc16Tms37157 = new AlgoParams("CRC-16/TMS37157", 16, 0x1021, 0x89EC, true, true, 0x0, 0x26B1); + public static AlgoParams Crc16Usb = new AlgoParams("CRC-16/USB", 16, 0x8005, 0xFFFF, true, true, 0xFFFF, 0xB4C8); + public static AlgoParams CrcA = new AlgoParams("CRC-A", 16, 0x1021, 0xc6c6, true, true, 0x0, 0xBF05); + public static AlgoParams Crc16Kermit = new AlgoParams("CRC-16/KERMIT", 16, 0x1021, 0x0, true, true, 0x0, 0x2189); + public static AlgoParams Crc16Modbus = new AlgoParams("CRC-16/MODBUS", 16, 0x8005, 0xFFFF, true, true, 0x0, 0x4B37); + public static AlgoParams Crc16X25 = new AlgoParams("CRC-16/X-25", 16, 0x1021, 0xFFFF, true, true, 0xFFFF, 0x906E); + public static AlgoParams Crc16Xmodem = new AlgoParams("CRC-16/XMODEM", 16, 0x1021, 0x0, false, false, 0x0, 0x31C3); + + public static final AlgoParams[] Params = new AlgoParams[] + { + Crc16CcittFalse, + Crc16Arc, + Crc16AugCcitt, + Crc16Buypass, + Crc16Cdma2000, + Crc16Dds110, + Crc16DectR, + Crc16DectX, + Crc16Dnp, + Crc16En13757, + Crc16Genibus, + Crc16Maxim, + Crc16Mcrf4Xx, + Crc16Riello, + Crc16T10Dif, + Crc16Teledisk, + Crc16Tms37157, + Crc16Usb, + CrcA, + Crc16Kermit, + Crc16Modbus, + Crc16X25, + Crc16Xmodem, + }; +} \ No newline at end of file diff --git a/Mifare Classic Tool/app/src/main/java/crccalc/Crc32.java b/Mifare Classic Tool/app/src/main/java/crccalc/Crc32.java new file mode 100644 index 00000000..9f9a1c13 --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/crccalc/Crc32.java @@ -0,0 +1,20 @@ +package crccalc; + +/** + * Created by anthony on 15.05.2017. + */ +public class Crc32 { + public static AlgoParams Crc32 = new AlgoParams("CRC-32", 32, 0x04C11DB7L, 0xFFFFFFFFL, true, true, 0xFFFFFFFFL, 0xCBF43926L); + public static AlgoParams Crc32Bzip2 = new AlgoParams("CRC-32/BZIP2", 32, 0x04C11DB7L, 0xFFFFFFFFL, false, false, 0xFFFFFFFFL, 0xFC891918L); + public static AlgoParams Crc32C = new AlgoParams("CRC-32C", 32, 0x1EDC6F41L, 0xFFFFFFFFL, true, true, 0xFFFFFFFFL, 0xE3069283L); + public static AlgoParams Crc32D = new AlgoParams("CRC-32D", 32, 0xA833982BL, 0xFFFFFFFFL, true, true, 0xFFFFFFFFL, 0x87315576L); + public static AlgoParams Crc32Jamcrc = new AlgoParams("CRC-32/JAMCRC", 32, 0x04C11DB7L, 0xFFFFFFFFL, true, true, 0x00000000L, 0x340BC6D9L); + public static AlgoParams Crc32Mpeg2 = new AlgoParams("CRC-32/MPEG-2", 32, 0x04C11DB7L, 0xFFFFFFFFL, false, false, 0x00000000L, 0x0376E6E7L); + public static AlgoParams Crc32Posix = new AlgoParams("CRC-32/POSIX", 32, 0x04C11DB7L, 0x00000000L, false, false, 0xFFFFFFFFL, 0x765E7680L); + public static AlgoParams Crc32Q = new AlgoParams("CRC-32Q", 32, 0x814141ABL, 0x00000000L, false, false, 0x00000000L, 0x3010BF7FL); + public static AlgoParams Crc32Xfer = new AlgoParams("CRC-32/XFER", 32, 0x000000AFL, 0x00000000L, false, false, 0x00000000L, 0xBD0BE338L); + + public static final AlgoParams[] Params = new AlgoParams[]{ + Crc32, Crc32Bzip2, Crc32C, Crc32D, Crc32Jamcrc, Crc32Mpeg2, Crc32Posix, Crc32Q, Crc32Xfer + }; +} \ No newline at end of file diff --git a/Mifare Classic Tool/app/src/main/java/crccalc/Crc64.java b/Mifare Classic Tool/app/src/main/java/crccalc/Crc64.java new file mode 100644 index 00000000..96d97fb4 --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/crccalc/Crc64.java @@ -0,0 +1,12 @@ +package crccalc; + +public class Crc64 { + public static AlgoParams Crc64 = new AlgoParams("CRC-64",64, 0x42F0E1EBA9EA3693L, 0x00000000L, false, false, 0x00000000L, 0x6C40DF5F0B497347L); + public static AlgoParams Crc64We = new AlgoParams("CRC-64/WE", 64, 0x42F0E1EBA9EA3693L, 0xFFFFFFFFFFFFFFFFL, false, false, 0xFFFFFFFFFFFFFFFFL,0x62EC59E3F1A4F00AL); + public static AlgoParams Crc64Xz = new AlgoParams("CRC-64/XZ", 64, 0x42F0E1EBA9EA3693L, 0xFFFFFFFFFFFFFFFFL, true, true, 0xFFFFFFFFFFFFFFFFL,0x995DC9BBDF1939FAL); + + + public static final AlgoParams[] Params = new AlgoParams[]{ + Crc64, Crc64We, Crc64Xz + }; +} diff --git a/Mifare Classic Tool/app/src/main/java/crccalc/Crc8.java b/Mifare Classic Tool/app/src/main/java/crccalc/Crc8.java new file mode 100644 index 00000000..98252095 --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/crccalc/Crc8.java @@ -0,0 +1,21 @@ +package crccalc; + +/** + * Created by anthony on 15.05.2017. + */ +public class Crc8 { + public static AlgoParams Crc8 = new AlgoParams("CRC-8", 8, 0x7, 0x0, false, false, 0x0, 0xF4); + public static AlgoParams Crc8Cdma2000 = new AlgoParams("CRC-8/CDMA2000", 8, 0x9B, 0xFF, false, false, 0x0, 0xDA); + public static AlgoParams Crc8Darc = new AlgoParams("CRC-8/DARC", 8, 0x39, 0x0, true, true, 0x0, 0x15); + public static AlgoParams Crc8DvbS2 = new AlgoParams("CRC-8/DVB-S2", 8, 0xD5, 0x0, false, false, 0x0, 0xBC); + public static AlgoParams Crc8Ebu = new AlgoParams("CRC-8/EBU", 8, 0x1D, 0xFF, true, true, 0x0, 0x97); + public static AlgoParams Crc8ICode = new AlgoParams("CRC-8/I-CODE", 8, 0x1D, 0xFD, false, false, 0x0, 0x7E); + public static AlgoParams Crc8Itu = new AlgoParams("CRC-8/ITU", 8, 0x7, 0x0, false, false, 0x55, 0xA1); + public static AlgoParams Crc8Maxim = new AlgoParams("CRC-8/MAXIM", 8, 0x31, 0x0, true, true, 0x0, 0xA1); + public static AlgoParams Crc8Rohc = new AlgoParams("CRC-8/ROHC", 8, 0x7, 0xFF, true, true, 0x0, 0xD0); + public static AlgoParams Crc8Wcdma = new AlgoParams("CRC-8/WCDMA", 8, 0x9B, 0x0, true, true, 0x0, 0x25); + + public static final AlgoParams[] Params = new AlgoParams[]{ + Crc8, Crc8Cdma2000, Crc8Darc, Crc8DvbS2, Crc8Ebu, Crc8ICode, Crc8Itu, Crc8Maxim, Crc8Rohc, Crc8Wcdma + }; +} \ No newline at end of file diff --git a/Mifare Classic Tool/app/src/main/java/crccalc/CrcCalculator.java b/Mifare Classic Tool/app/src/main/java/crccalc/CrcCalculator.java new file mode 100644 index 00000000..e67dae7f --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/crccalc/CrcCalculator.java @@ -0,0 +1,91 @@ +package crccalc; + +/** + * Created by anthony on 11.05.2017. + */ +public class CrcCalculator { + + public AlgoParams Parameters; + public byte HashSize = 8; + private long _mask = 0xFFFFFFFFFFFFFFFFL; + private long[] _table = new long[256]; + + public static final byte[] TestBytes = new byte[]{49,50,51,52,53,54,55,56,57}; + + CrcCalculator(AlgoParams params) + { + Parameters = params; + + HashSize = (byte) params.HashSize; + if (HashSize < 64) + { + _mask = (1L << HashSize) - 1; + } + + CreateTable(); + } + + public long Calc(byte[] data, int offset, int length) + { + long init = Parameters.RefOut ? CrcHelper.ReverseBits(Parameters.Init, HashSize) : Parameters.Init; + long hash = ComputeCrc(init, data, offset, length); + return (hash ^ Parameters.XorOut) & _mask; + } + + private long ComputeCrc(long init, byte[] data, int offset, int length) + { + long crc = init; + + if (Parameters.RefOut) + { + for (int i = offset; i < offset + length; i++) + { + crc = (_table[(int)((crc ^ data[i]) & 0xFF)] ^ (crc >>> 8)); + crc &= _mask; + } + } + else + { + int toRight = (HashSize - 8); + toRight = toRight < 0 ? 0 : toRight; + for (int i = offset; i < offset + length; i++) + { + crc = (_table[(int)(((crc >> toRight) ^ data[i]) & 0xFF)] ^ (crc << 8)); + crc &= _mask; + } + } + + return crc; + } + + private void CreateTable() + { + for (int i = 0; i < _table.length; i++) + _table[i] = CreateTableEntry(i); + } + + private long CreateTableEntry(int index) + { + long r = (long)index; + + if (Parameters.RefIn) + r = CrcHelper.ReverseBits(r, HashSize); + else if (HashSize > 8) + r <<= (HashSize - 8); + + long lastBit = (1L << (HashSize - 1)); + + for (int i = 0; i < 8; i++) + { + if ((r & lastBit) != 0) + r = ((r << 1) ^ Parameters.Poly); + else + r <<= 1; + } + + if (Parameters.RefOut) + r = CrcHelper.ReverseBits(r, HashSize); + + return r & _mask; + } +} diff --git a/Mifare Classic Tool/app/src/main/java/crccalc/CrcHelper.java b/Mifare Classic Tool/app/src/main/java/crccalc/CrcHelper.java new file mode 100644 index 00000000..33e83882 --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/crccalc/CrcHelper.java @@ -0,0 +1,20 @@ +package crccalc; + +/** + * Created by anthony on 13.05.2017. + */ +public class CrcHelper { + + static long ReverseBits(long ul, int valueLength) + { + long newValue = 0; + + for (int i = valueLength - 1; i >= 0; i--) + { + newValue |= (ul & 1) << i; + ul >>= 1; + } + + return newValue; + } +} diff --git a/Mifare Classic Tool/app/src/main/java/crccalc/Main.java b/Mifare Classic Tool/app/src/main/java/crccalc/Main.java new file mode 100644 index 00000000..ad4b61db --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/crccalc/Main.java @@ -0,0 +1,39 @@ +package crccalc; + +import android.util.Log; + +public class Main { + + public static void main(String[] args) { + Check(Crc8.Params); + + Check(Crc16.Params); + + Check(Crc32.Params); + + Check(Crc64.Params); + } + + private static void Check(AlgoParams[] params) { + for (AlgoParams param : params) { + CrcCalculator calculator = new CrcCalculator(param); + long result = calculator.Calc(CrcCalculator.TestBytes, 0, CrcCalculator.TestBytes.length); + Log.i(calculator.Parameters.Name, Long.toHexString(result).toUpperCase()); + if (result != calculator.Parameters.Check) + Log.d("LOG:", calculator.Parameters.Name + " - BAD ALGO!!! " + Long.toHexString(result).toUpperCase()); + } + } + + public static StringBuilder Calculate(AlgoParams[] params) { + StringBuilder res = new StringBuilder(); + for (AlgoParams param : params) { + CrcCalculator calculator = new CrcCalculator(param); + long result = calculator.Calc(CrcCalculator.TestBytes, 0, CrcCalculator.TestBytes.length); + if (result != calculator.Parameters.Check) { + Log.d("LOG:", calculator.Parameters.Name + " - BAD ALGO!!! " + Long.toHexString(result).toUpperCase()); + } + res.append(String.format("%s : %s", calculator.Parameters.Name, Long.toHexString(result).toUpperCase())).append("\n"); + } + return res; + } +} \ No newline at end of file diff --git a/Mifare Classic Tool/app/src/main/java/crccalc/license.txt b/Mifare Classic Tool/app/src/main/java/crccalc/license.txt new file mode 100644 index 00000000..9bf4c3a2 --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/crccalc/license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Anton Isakov http://crccalc.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Mifare Classic Tool/app/src/main/java/de/syss/MifareClassicTool/Activities/CrcCalc.java b/Mifare Classic Tool/app/src/main/java/de/syss/MifareClassicTool/Activities/CrcCalc.java new file mode 100644 index 00000000..92ca12f8 --- /dev/null +++ b/Mifare Classic Tool/app/src/main/java/de/syss/MifareClassicTool/Activities/CrcCalc.java @@ -0,0 +1,31 @@ +package de.syss.MifareClassicTool.Activities; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; + +import crccalc.Crc16; +import crccalc.Crc32; +import crccalc.Crc64; +import crccalc.Crc8; +import crccalc.Main; +import de.syss.MifareClassicTool.R; + +public class CrcCalc extends Activity { + + TextView textView; + String text = ""; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_crc_calc); + textView = findViewById(R.id.textView); + text += Main.Calculate(Crc8.Params) + "\n"; + text += Main.Calculate(Crc16.Params) + "\n"; + text += Main.Calculate(Crc32.Params) + "\n"; + text += Main.Calculate(Crc64.Params) + "\n"; + textView.setText(text); + } + +} diff --git a/Mifare Classic Tool/app/src/main/java/de/syss/MifareClassicTool/Activities/MainMenu.java b/Mifare Classic Tool/app/src/main/java/de/syss/MifareClassicTool/Activities/MainMenu.java index ca744358..a99d20be 100644 --- a/Mifare Classic Tool/app/src/main/java/de/syss/MifareClassicTool/Activities/MainMenu.java +++ b/Mifare Classic Tool/app/src/main/java/de/syss/MifareClassicTool/Activities/MainMenu.java @@ -914,6 +914,10 @@ public boolean onContextItemSelected(MenuItem item) { intent = new Intent(this, BccTool.class); startActivity(intent); return true; + case R.id.menuMainCrcCalc: + intent = new Intent(this, CrcCalc.class); + startActivity(intent); + return true; case R.id.menuMainCloneUidTool: intent = new Intent(this, CloneUidTool.class); startActivity(intent); diff --git a/Mifare Classic Tool/app/src/main/res/layout/activity_crc_calc.xml b/Mifare Classic Tool/app/src/main/res/layout/activity_crc_calc.xml new file mode 100644 index 00000000..8d9f599c --- /dev/null +++ b/Mifare Classic Tool/app/src/main/res/layout/activity_crc_calc.xml @@ -0,0 +1,20 @@ + + + + + + + + + + diff --git a/Mifare Classic Tool/app/src/main/res/menu/tools.xml b/Mifare Classic Tool/app/src/main/res/menu/tools.xml index 84c8b7fb..a2360268 100644 --- a/Mifare Classic Tool/app/src/main/res/menu/tools.xml +++ b/Mifare Classic Tool/app/src/main/res/menu/tools.xml @@ -30,6 +30,8 @@ android:title="@string/action_show_diff_tool" /> + \ No newline at end of file diff --git a/Mifare Classic Tool/app/src/main/res/values/strings.xml b/Mifare Classic Tool/app/src/main/res/values/strings.xml index c8d4f8fc..e0cb1299 100644 --- a/Mifare Classic Tool/app/src/main/res/values/strings.xml +++ b/Mifare Classic Tool/app/src/main/res/values/strings.xml @@ -46,6 +46,7 @@ Diff Tool BCC Calculator Clone UID to Magic Tag (2nd gen) + CrcCalc Choose some key file(s): @@ -245,6 +246,7 @@ Access Condition De-/Encoder Diff Tool (Compare Dumps) BCC Calculator + CRC Calc Clone UID Compare Dump Create New File