Method: Radius::Packet.auth_resp

Defined in:
lib/radius/packet.rb

.auth_resp(packed_packet, secret) ⇒ Object

Given a (packed) RADIUS packet and a shared secret, returns a new packet with the authenticator field changed in accordance with RADIUS protocol requirements.

Parameters

packed_packet

The packed packet to compute a new Authenticator field for.

secret

The shared secret of the RADIUS system.

Return value

a new packed packet with the authenticator field recomputed.



498
499
500
501
502
# File 'lib/radius/packet.rb', line 498

def Packet.auth_resp(packed_packet, secret)
  new = String.new(packed_packet)
  new[4, 16] = Digest::MD5.digest(packed_packet + secret)
  return(new)
end