Problem with bcrypt and Flet #5432
Unanswered
ingdesarr1
asked this question in
Q&A
Replies: 1 comment
-
Hola 👋, el error que estás viendo: suele ocurrir cuando
Esto es más notorio al ejecutar con ✅ SoluciónConvierte los hashes manualmente desde import bcrypt
import flet as ft
import logging
logging.basicConfig(level=logging.DEBUG)
def verificar_datos():
datos = ['A4RG0A60075', '000D22:7DB4E4']
hashes_str = [
'$2b$12$Z4Bfcu/32o74OizvRY.7IeX0wEhoEzjJHFfMUndhiF7Ghj88S9X6m',
'$2b$12$FNQIjvQe0yorYsBXEaSFierlB70KpnFJ2P4U5YTuJ71r0QognZIf.'
]
# Convertimos a bytes correctamente
encrip = [h.encode("utf-8") for h in hashes_str]
for dato, rec in zip(datos, encrip):
result = bcrypt.checkpw(dato.encode(), rec)
print(f'{dato} → {result}')
def main(page: ft.Page):
page.title = "AltronBatch"
verificar_datos()
if __name__ == '__main__':
ft.app(target=main, assets_dir="assets")
-----------------------------
📌 Notas
Evita usar directamente b'...' con hashes copiados de otros entornos.
Asegúrate siempre de convertir el hash a bytes desde str usando .encode().
Espero que esto te sea útil. Si te funciona, ¡marca la respuesta como aceptada! ✅
Estoy para ayudarte si necesitas más soporte.
¡Mucho éxito con tu app Flet! 🚀 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Good morning. I currently want to use bcrypt to save and compare information within my application. If I perform the encryption and comparison process in a separate program, it works fine, but when I run my application using flet main.py, the process stops working, indicating that there is a problem using bcrypt with the hash_password. This only happens if I run the file using flet main.py; if I run it from VSCode, using Run python file, the problem does not arise. What could be causing this situation?
Code sample
Error message
------------------------------------------------------
Beta Was this translation helpful? Give feedback.
All reactions