コード例 #1
0
ファイル: test.py プロジェクト: Tethik/qrpass
	def test_qr_gen_and_load(self):
		master_pass = "".join(random.sample(string.letters, 10))
		aes_key = "".join(random.sample(string.letters, 16))
		plaintext = "".join(random.sample(string.letters, 50))		
		
		img = makeqr.encrypted_qr(master_pass, aes_key, plaintext)
		img.save("test.png")
		
		plain = readqr.decrypted_qr(master_pass, aes_key, "test.png")
		self.assertEqual(plaintext, plain)
コード例 #2
0
ファイル: camera.py プロジェクト: Tethik/qrpass
    def get_and_flip(self):
        # if you don't want to tie the framerate to the camera, you can check
        # if the camera has an image ready.  note that while this works
        # on most cameras, some will never return true.
        if self.cam.query_image():
            self.snapshot = self.cam.get_image(self.snapshot)

        # blit it to the display surface.  simple!
        self.display.blit(self.snapshot, (0, 0))
        pygame.display.flip()

        if self.find_qr_code():
            master_password = getpass.getpass("Master password: "******"tmp/img.png")
            password = readqr.decrypted_qr(master_password, aes_key, "tmp/img.png")
            pyperclip.copy(password)
            print "Password copied to clipboard!"
            self.cam.stop()
            exit(0)