• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [Newbie] Using FetchSpecs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Newbie] Using FetchSpecs


  • Subject: Re: [Newbie] Using FetchSpecs
  • From: Kieran Kelleher <email@hidden>
  • Date: Fri, 30 Apr 2004 22:47:26 -0400

...... and here is my password encryption class to support the login
code .... I hope this helps ............

// Class WkPassword.
// Creates an encrypted password and compares a clear text test password
// to a previously encrypted password

import java.security.*;

public class WKPassword
{
     public static String getEncodedPassword(String clearTextPassword,
String algorithm)
     throws NoSuchAlgorithmException
{
     MessageDigest md = MessageDigest.getInstance(algorithm);

     md.update(clearTextPassword.getBytes());

     return HexString.bufferToHex(md.digest());
}

public static boolean testPassword(String clearTextTestPassword,
				   String encodedActualPassword,
				   String algorithm)
throws NoSuchAlgorithmException
{
     String encodedTestPassword = WKPassword.getEncodedPassword(
							       clearTextTestPassword,
							       algorithm);

     // We should ignore case since the encoded item is hexadecimal
     // and while the java encryption functions may return upper case
     // for the A, B, C, etc. hexadecimal characters, databases such as
     // MySQL will output lower case a, b, c, etc hex characters.
     // In reality, capital A B C D E F G should be used for hexadecimal,
     // but it is safer to ignore case (just in case!)
     return
(encodedTestPassword.equalsIgnoreCase(encodedActualPassword));
}
}


________________________________________________________________
Config = OS X 10.3.3 / Java 1.4.1 /  WO 5.2.2 / XCode v1.1 / MySQL
4.0.18 / Connector-J 3.0.11
Blog: http://webobjects.webhop.org/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >[Newbie] Using FetchSpecs (From: Lucas Haley <email@hidden>)
 >Re: [Newbie] Using FetchSpecs (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: [Newbie] Using FetchSpecs
  • Next by Date: Re: [Newbie] MySQL "PASSWORD" in WO?
  • Previous by thread: Re: [Newbie] Using FetchSpecs
  • Next by thread: EOM: Keeping two Schemas in Synch
  • Index(es):
    • Date
    • Thread