package Ġcom . li any i . pa im ons notebook . util Ċ Ċ import Ġcom . li any i . pa im ons notebook . lib . information . Constants Ċ import Ġjava . math . BigInteger Ċ import Ġjava . security . Message Digest Ċ Ċ fun Ġget DS ( query : ĠString , Ġbody : ĠString Ġ= Ġ"") : ĠString Ġ{ ĊĠĠĠ Ġval Ġtime Ġ= ĠSystem . currentTimeMillis () Ġ/ Ġ 1 0 0 0 L ĊĠĠĠ Ġval Ġrs Ġ= Ġget RS () ĊĠĠĠ Ġval Ġcs Ġ= Ġ" salt =${ Constants . API _ SAL T }& t =${ time }& r =${ rs }& b =$ body & q =$ query ". digest ( Algorithm . MD 5 ) ĊĠĠĠ Ġreturn Ġ"${ time }, ${ rs }, ${ cs }" Ċ } Ċ Ċ fun Ġget Sign DS ( salt : ĠString ): ĠString Ġ{ ĊĠĠĠ Ġval Ġtime Ġ= ĠSystem . currentTimeMillis () Ġ/ Ġ 1 0 0 0 L ĊĠĠĠ Ġval Ġrs Ġ= Ġget RS () ĊĠĠĠ Ġval Ġcs Ġ= Ġ" salt =$ salt & t =${ time }& r =${ rs }". digest ( Algorithm . MD 5 ) ĊĠĠĠ Ġreturn Ġ"${ time }, ${ rs }, ${ cs }" Ċ } Ċ Ċ fun Ġget RS (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġ( 1 0 0 0 0 0 .. 2 0 0 0 0 0 ). random (). toString () Ċ } Ċ Ċ fun ĠString . digest ( algorithm : ĠAlgorithm ): ĠString Ġ= ĠMessage Digest . getInstance ( algorithm . s ). run Ġ{ ĊĠĠĠ ĠBigInteger ( 1 , Ġdigest ( toByteArray ())). toString ( 1 6 ). pad Start ( algorithm . length , Ġ' 0 ') Ċ } Ċ Ċ @ Suppress (" Enum Entry Name ") Ċ enum Ġclass ĠAlgorithm ( ĊĠĠĠ Ġval Ġs : ĠString , ĊĠĠĠ Ġval Ġlength : ĠInt Ċ ) Ġ{ ĊĠĠĠ ĠMD 2 (" MD 2 ", Ġ 3 2 ), ĊĠĠĠ ĠMD 5 (" MD 5 ", Ġ 3 2 ), ĊĠĠĠ ĠSh a 1 (" SHA - 1 ", Ġ 4 0 ), ĊĠĠĠ ĠSh a 2 2 4 (" SHA - 2 2 4 ", Ġ 5 6 ), ĊĠĠĠ ĠSh a 2 5 6 (" SHA - 2 5 6 ", Ġ 6 4 ), ĊĠĠĠ ĠSh a 3 8 4 (" SHA - 3 8 4 ", Ġ 9 6 ), ĊĠĠĠ ĠSh a 5 1 2 (" SHA - 5 1 2 ", Ġ 1 2 8 ), ĊĠĠĠ Ġ` Sha 5 1 2 - 2 2 4 ` (" SHA - 5 1 2 / 2 2 4 ", Ġ 5 6 ), ĊĠĠĠ Ġ` Sha 5 1 2 - 2 5 6 ` (" SHA - 5 1 2 / 2 5 6 ", Ġ 6 4 ), ĊĠĠĠ Ġ` Sha 3 - 2 2 4 ` (" SHA 3 - 2 2 4 ", Ġ 5 6 ), ĊĠĠĠ Ġ` Sha 3 - 3 8 4 ` (" SHA 3 - 3 8 4 ", Ġ 9 6 ), ĊĠĠĠ Ġ` Sha 3 - 5 1 2 ` (" SHA 3 - 5 1 2 ", Ġ 1 2 8 ) Ċ } Ċ Ċ fun Ġget Q 1 ( uid : ĠString , Ġserver : ĠString ): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġ" role _ id =$ uid & server =$ server " Ċ } ĊĊĊ