1 /** 2 * com.sekati.crypt.GUID 3 * @version 1.0.1 4 * @author jason m horwitz | sekati.com 5 * Copyright (C) 2007 jason m horwitz, Sekat LLC. All Rights Reserved. 6 * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php 7 * 8 * Sourced from ascrypt for dependencies only - version 2.0, author Mika Pamu 9 */ 10 11 import com.sekati.crypt.IHash; 12 import com.sekati.crypt.SHA1; 13 14 /** 15 * Creates a new genuine unique identifier string. 16 */ 17 class com.sekati.crypt.GUID implements IHash { 18 19 private static var counter:Number = 0; 20 21 /** 22 * Creates a new Genuine Unique IDentifier. 23 * @return String 24 */ 25 public static function create():String { 26 var id1:Number = new Date( ).getTime( ); 27 var id2:Number = Math.random( ) * Number.MAX_VALUE; 28 var id3:String = System.capabilities.serverString; 29 return SHA1.calculate( id1 + id3 + id2 + counter++ ); 30 } 31 32 private function GUID() { 33 } 34 }