Jefferson module

class ciphers.Jefferson.Jefferson[source]

Bases: flask_restful.Resource

check_wheel_parameters(wheel_order)[source]

This is to ensure that user provided wheel order is meets the criteria. The wheel order must be values [0-24],no repeats and comma seperated. :param wheel_order:

Returns:True if the wheel order is valid otherwise False.
decode(encode_input, shiftFactor, wheel_order)[source]

This performs the decoding of the message.The shiftfactor is negative for decoding.

Parameters:
  • user_input – The message provided to the cipher.
  • shiftFactor – The line which to read the message
  • wheel_order – the order of the 25 wheels.
Returns:

The decoded message and the wheel order used in json format.

encode(user_input, shift, wheel_order)[source]

This performs the encoding of the cipher text.The shift factor is positive to encode the message.

Parameters:
  • user_input – The message provided to the cipher.
  • shift – the line which to read from.
  • wheel_order – the order of the 25 wheels.
Returns:

The encoded message,shift value and wheel order in json format.

get()[source]

This is the method that handles GET Requests for Jefferson wheel Cipher :param None since a Custom Parser Object is imported from CustomParser:

Returns:The output of the encode/decode functions.
methods = {'GET'}
stringify_wheel(wheel_order)[source]

To provide the user a copy and paste method to share wheel orders :param wheel_order: The order of the provided wheels.

Returns:The wheel order in a comma seperated string