Class UUIDUtil

java.lang.Object
fc.util.UUIDUtil

public final class UUIDUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
     
    static String
    Returns a 8 character string suitable for tracking, affiliate, short codes, etc.
    static String
    newID(int len)
    Returns a N-char string suitable for tracking, affiliate, short codes, etc.
    static String
    Returns a ID suitable for a session/cookie identifier.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • newSessionID

      public static String newSessionID()
      Returns a ID suitable for a session/cookie identifier.
      See: cookies.lcs.mit.edu
      See: www.across.si
      
      There are 2 issues with generating sessionid's. 
      
      1) uniqueness - 2 or more sessionid's should not end up being 
         the same.
      2) hard-to-guess - For example, sequential values like 
         1, 2, 3 are unique but easy to guess and therefore easy
         to session hijack.
      
      Our sessionid's have 2 parts:
      a) a timestamp for guaranteed uniqueness  (easy to guess)
      b) random data (hard to guess)
      
    • newID

      public static String newID(int len)
      Returns a N-char string suitable for tracking, affiliate, short codes, etc. Uses characters safe for all URL's.
      Parameters:
      len - the length of the returned string
    • newID

      public static String newID()
      Returns a 8 character string suitable for tracking, affiliate, short codes, etc. Uses characters safe for all URL's.
    • main

      public static void main(String[] args)