IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

15 lines
326B

  1. import random
  2. from .zfs import zfs_exists
  3. def random_sha256_hexdigest():
  4. return bytes([ random.randint(0, 255) for _ in range(32) ]).hex()
  5. def find_prefix(head, tail):
  6. for pre in range(7, len(tail)):
  7. name = head + tail[:pre]
  8. if not zfs_exists(name):
  9. break
  10. return name