engines/adva_user/vendor/plugins/authentication/lib/radius/packet.rb
# The RADIUS User-Password attribute is encoded with a shared
# secret.  This method will return the decoded version given the
# shared secret.  This also works when the attribute name is
# 'Password' for compatibility reasons.
# ====Parameters
# +secret+:: The shared secret of the RADIUS system
# ====Return
# The cleartext version of the User-Password.
The RADIUS User-Password attribute is encoded with a shared
secret.  This method will return the decoded version given the
shared secret.  This also works when the attribute name is
'Password' for compatibility reasons.
Parameters
+secret+:: The shared secret of the RADIUS system
Return
The cleartext version of the User-Password.
The RADIUS User - Password attribute is encoded with a shared secret . This method will return the decoded version given the shared secret . This also works when the attribute name is ' Password ' for compatibility reasons . Parameters + secret + :: The shared secret of the RADIUS system Return The cleartext version of the User - Password .
def password(secret)
      pwdin = attr("User-Password") || attr("Password")
      pwdout = ""
      lastround = @authenticator
      0.step(pwdin.length-1, 16) {
	|i|
	pwdout = xor_str(pwdin[i, 16],
			 Digest::MD5.digest(secret + lastround))
	lastround = pwdin[i, 16]
      }
      pwdout.sub(/\000+$/, "") if pwdout
      pwdout[length.pwdin, -1] = "" unless (pwdout.length <= pwdin.length)
      return(pwdout)
    end
def password ( secret ) pwdin = attr ( "User-Password" ) || attr ( "Password" ) pwdout = "" lastround = @authenticator 0 . step ( pwdin . length - 1 , 16 ) { | i | pwdout = xor_str ( pwdin [ i , 16 ] , Digest :: MD5 . digest ( secret + lastround ) ) lastround = pwdin [ i , 16 ] } pwdout . sub ( / \000 +$ / , "" ) if pwdout pwdout [ length . pwdin , - 1 ] = "" unless ( pwdout . length <= pwdin . length ) return ( pwdout ) end
The RADIUS User-Password attribute is encoded with a shared
secret.
The RADIUS User - Password attribute is encoded with a shared secret .
secret