CopyPastor

Detecting plagiarism made easy.

Score: 0.8013666272163391; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-03-04
by Vijay Singh Chouhan

Original Post

Original - Posted on 2014-07-09
by Cristiana Chavez



            
Present in both answers; Present only in the new answer; Present only in the old answer;

String android_id = android.provider.Settings.Secure.getString(this.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase();


public static String md5(final String s) { try { // Create MD5 Hash MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(s.getBytes()); byte messageDigest[] = digest.digest(); // Create Hex String StringBuilder hexString; hexString = new StringBuilder(); for (byte aMessageDigest : messageDigest) { StringBuilder h = new StringBuilder(Integer.toHexString(0xFF & aMessageDigest)); while (h.length() < 2) h.insert(0, "0"); hexString.append(h); } return hexString.toString(); } catch (NoSuchAlgorithmException ignored) { } return ""; }

To get the Hash Device ID
inside the oncreate
String android_id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID); String deviceId = md5(android_id).toUpperCase(); Log.i("device id=",deviceId);

then add this class for md5 ()

public String md5(String s) { try { // Create MD5 Hash MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); digest.update(s.getBytes()); byte messageDigest[] = digest.digest(); // Create Hex String StringBuffer hexString = new StringBuffer(); for (int i=0; i<messageDigest.length; i++) hexString.append(Integer.toHexString(0xFF & messageDigest[i])); return hexString.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return ""; }

        
Present in both answers; Present only in the new answer; Present only in the old answer;