public static String generateRid ( ) { byte [ ] encode = Base64 . getEncoder ( ) . encode ( DigestUtils . sha256 ( UUID . randomUUID ( ) . toString ( ) ) ) ; try { String rid = new String ( encode , StandardCharsets . UTF_8 . name ( ) ) ; rid = StringUtils . replaceChars ( rid , "+/=" , "" ) ; return StringUtils . right ( rid , RID_LENGTH ) ; } catch ( UnsupportedEncodingException e ) { throw new IllegalStateException ( e ) ; } }
Generates request id based on UID and SHA - 256 .