Project

General

Profile

« Previous | Next » 

Revision c0c95621

Added by Neels Hofmeyr about 4 years ago

add hexdump()

View differences:

sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java
263 263
		return mi;
264 264
	}
265 265

  
266
	private byte nibble2hex(byte nibble)
267
	{
268
		nibble = (byte)(nibble & 0xf);
269
		if (nibble < 0xa)
270
			return (byte)('0' + nibble);
271
		else
272
			return (byte)('a' + nibble - 0xa);
273
	}
274

  
275
	private byte[] hexdump(byte data[])
276
	{
277
		byte res[] = new byte[(byte)(data.length*2)];
278
		for (byte i = 0; i < data.length; i++) {
279
			res[(byte)(i*2)] = nibble2hex((byte)(data[i] >> 4));
280
			res[(byte)(i*2 + 1)] = nibble2hex(data[i]);
281
		}
282
		return res;
283
	}
284

  
266 285
	private void showIMSI() {
267 286
		/* 3GPP TS 31.102 4.2.2: IMSI */
268 287
		byte[] IMSI = new byte[9];

Also available in: Unified diff

Add picture from clipboard (Maximum size: 48.8 MB)