예제 #1
0
    def get_otp_modehex_interpretation(self, otp):
        # We only use the first interpretation, because
        # if the OTP uses all 16 characters in its alphabet
        # there is only one possible interpretation of that otp
        try:
            otp_translated = modhex.translate(unicode(otp)).pop()
        except Exception:
            otp_translated = otp

        return otp_translated
예제 #2
0
	def get_otp_modehex_interpretation(self, otp):
		# We only use the first interpretation, because
		# if the OTP uses all 16 characters in its alphabet
		# there is only one possible interpretation of that otp
		try:
			otp_translated = modhex.translate(unicode(otp)).pop()
		except Exception:
			otp_translated = otp
		
		return otp_translated
예제 #3
0
    def get_otp_modehex_interpretation(self, otp):
        # We only use the first interpretation, because
        # if the OTP uses all 16 characters in its alphabet
        # there is only one possible interpretation of that otp
        try:
            interpretations = modhex.translate(unicode(otp))
        except Exception:
            return otp

        if len(interpretations) == 0:
            return otp
        elif len(interpretations) > 1:
            # If there are multiple interpretations first try to use the same
            # translation as the input OTP. If the one is not found, use the
            # random interpretation.
            if unicode(otp) in interpretations:
                return otp

        return interpretations.pop()