Skip to content

Commit e2619c7

Browse files
Refactor bit distribution print and add image_signature function
Updated print statement for bit distribution and added image signature helper function.
1 parent 15fc4bb commit e2619c7

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

kha256/kha256.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6694,7 +6694,7 @@ def test_uniformity(self, samples: int = 10_000) -> Dict[str, Any]:
66946694
)
66956695

66966696
print("\n" + "─" * 70)
6697-
print("🎲 BIT DISTRIBUTION")
6697+
print("🔀 BIT DISTRIBUTION")
66986698
print("─" * 70)
66996699
print(
67006700
f" • Min Ones: {result['bit_min']:,} (Expected: {int(expected_ones):,})"
@@ -13873,6 +13873,15 @@ def scrypt_dual_output(min_deger=0, max_deger=100):
1387313873

1387413874
return sabit_sayi, rastgele_sayi
1387513875

13876+
# ========== GÖRÜNTÜ İMZALAMA YARDIMCISI ==========
13877+
def image_signature(image_array: np.ndarray, secret_key: bytes, deterministic: bool = False) -> str:
13878+
"""
13879+
Bir numpy görüntü dizisinin (RGB uint8) KHA-256 özetini döndürür.
13880+
deterministic=True ise salt kullanılmaz (sabit çıktı).
13881+
"""
13882+
kha = KHA256()
13883+
return kha.hash(image_array.tobytes(), salt=secret_key if not deterministic else b'', deterministic=deterministic)
13884+
1387613885

1387713886
def run_all_tests():
1387813887
"""Bütün memory-hard sınıfı testlerini çalıştırır"""

0 commit comments

Comments
 (0)