Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Alternative to the 120k limit on rounds for hashed password imports using auth.UserImportHash.pbkdf2_sha256

Đang mở
#512 8 bình luận 7 reaction 1 người được giao Xem trên GitHub

@bojeil-google đang làm issue này rồi.

Từ ngày 8/12/2020.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

api: auth

I'm looking to migrate users from Django to firebase, below is the code I'm using for testing. The issue I'm facing is that it seems that the passwords have been hashed using 150k rounds when the firebase docs says the maximum is 120k for SHA256: https://firebase.google.com/docs/auth/admin/import-users#python

Is there an alternative?

Here is the error I get:
ValueError: rounds must not be larger than 120000.

import firebase_admin
from firebase_admin import auth, exceptions
from passlib.utils import to_bytes


server_path = ''
fb_credentials = firebase_admin.credentials.Certificate(server_path + 'files/serviceAccount.json')
firebase_admin.initialize_app(fb_credentials)


old_hash = 'pbkdf2_sha256$150000$rsWX3Dbbd3K6$EYgXPBAz/Ero9PIgIFs/8pWGmGT+diTOQs1DZv4Ytjw='
email = 'user@gmail.com'

rounds = int(old_hash.split('$')[1])
salt = old_hash.split('$')[2]

users = [
    auth.ImportUserRecord(
        uid='70sSUptkmkN95QTFJ0gWduzdlpP1',
        email=email,
        password_hash=to_bytes(old_hash),
        password_salt=to_bytes(salt)
    ),
]

hash_alg = auth.UserImportHash.pbkdf2_sha256(rounds=rounds)
try:
    result = auth.import_users(users, hash_alg=hash_alg)
    for err in result.errors:
        print('Failed to import user:', err.reason)
except exceptions.FirebaseError as error:
    print('Error importing users:', error)
Ngôn ngữ chính
Python
Star
1.2k
Fork
359
Merge trung bình
3 ngày 9 giờ
Pull request đã merge (30 ngày)
3

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của firebase/firebase-admin-python

Tất cả issue của firebase/firebase-admin-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.