Tuesday, 7 August 2012

Random Password Generator


public String generator(Integer len){
Blob blobKey = crypto.generateAesKey(128);
String key = EncodingUtil.convertToHex(blobKey);
return key.substring(0,len);
}//Where len is the length of the password which we want to generate
    It will return alphanumeric password, some cases it won't return alphanumeric password in that case we should use condition that value should be at least one character.

Refer:
Random Password Generator



No comments:

Post a Comment

Labels