def __init__(self, callback=None, tag_type=TagType.ULTRALIGHT, memory=None, rands=None): self._tag_type = tag_type self._mem = memory if tag_type == TagType.CLASSIC1K: self._random = Rand(rands) keya, keyb = Tag.get_keys_from_mem(self._mem) self._keya = keya self._keyb = keyb self._callback = callback if callback else self._display if self._tag_type == TagType.ULTRALIGHT: self.process_packet = self.process_packet_ul elif self._tag_type == TagType.CLASSIC1K: self.process_packet = self.process_packet_1k else: print "TAG TYPE UNSUPPORTED" self._uid = self._get_uid() self._halt = False self._selected = False self._encode = None self._reset()
def __init__(self, source_dir): source_retriever = SourceRetriever(source_dir) transition_builder = TransitionBuilder() speaker_collection = SpeakerCollection(source_retriever) transition_retriever = CachedTransitionRetriever( source_retriever, transition_builder, speaker_collection) rand = Rand() quote_generator = QuoteGenerator(rand) self.quote_processor = QuoteRequestProcessor(transition_retriever, quote_generator) start_time = datetime.datetime.fromtimestamp(time.time()) self.meta_processor = MetaRequestProcessor(transition_retriever, speaker_collection, rand, start_time) self.processors = { config.GENERATE_REQUEST_TRIGGER: (self.quote_processor, { "direction": QuoteDirection.BIDI }), config.GENERATE_FORWARD_REQUEST_TRIGGER: (self.quote_processor, { "direction": QuoteDirection.FORWARD }), config.GENERATE_REVERSE_REQUEST_TRIGGER: (self.quote_processor, { "direction": QuoteDirection.REVERSE }), config.META_REQUEST_TRIGGER: (self.meta_processor, {}), }
def __init__(self, callback=None, rands=None, keya=None, keyb=None): self._callback = callback if callback else self._display self._encoder = None self._random = Rand(rands) self._keya = keya self._keyb = keyb self._key = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF ] if not self._keya else self._keya self._reset_tag() self._encode = None
from ui import Ui def decrypt(text, key): print(text) sm_decryp = sm.decrypting(text, key) print(sm_decryp) # print('crypt_chan v0.0.1') print('для расшифровки напишите decrypt') print('для засшифровки напишите crypt') # random_key = Rand() key = random_key.randomString() # usr = Ui(key) usr_inp = usr.input_ask() usr_ask = usr.rand_key(key) # sm = SecretMessage(usr_inp, key) sm_encryp = sm.encrypting(usr_inp, key) sm_encryp_str = str(sm_encryp) #print(sm_encryp_str[2:-1]) fix
def create_rand(): from rand import Rand rnd = Rand(seed=28) return rnd
def create_rand(): rand = Rand(seed=28) return rand