Back to project page dandy.
The source code is released under:
GNU General Public License
If you think the Android project dandy listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.workhabit.drupal.api.site.support; //from ww w. j av a 2s.c om import org.workhabit.drupal.api.site.NonceFactory; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * Copyright 2009 - WorkHabit, Inc. - acs * Date: 11/17/10, 3:23 PM */ public class NonceFactoryImpl implements NonceFactory { public String getNonce() { try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(Double.toString(System.currentTimeMillis() + Math.random()).getBytes()); StringBuffer hexString = new StringBuffer(); byte messageDigest[] = digest.digest(); for (byte aMessageDigest : messageDigest) { hexString.append(Integer.toHexString(0xFF & aMessageDigest)); } return hexString.toString(); } catch (NoSuchAlgorithmException e) { // not happening. } return null; } }