java - Concept for OTP with Time limit -
programme a:
hash(username, password , nowtime())
*nowtime() defined as:
calendar cal = calendar.getinstance(); cal.gettime()
programme b:
hash(username, password , nowtime())
*programme b loop (up 15 sec) , each nowtime() defined as:
calendar cal = calendar.getinstance(); cal.add(calendar.second, -1);
though time both programme matches, otp produced same hash function different. not need code, please me understand sync time between 2 programme.
calendar.gettime()
returns time resolution of 1 milli second. therefore milli second values surely different on both computers (or same pure luck).
to go solution have set milli seconds 0
before processing
cal.set(calendar.millisecond, 0);
then should have @ least 1 match.
Comments
Post a Comment