Skip to content

Commit 992289d

Browse files
committed
fix: remove emoji characters from test output for Windows cp1252 compatibility
1 parent eb28989 commit 992289d

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

.github/workflows/test-and-build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ jobs:
164164
run: |
165165
pip install dist/*.whl
166166
167-
- name: Test basic import
168-
run: |
169-
python -c "import libcrypto; from libcrypto import PrivateKey, Wallet, generate_mnemonic; print('LibCrypto imported successfully')"
167+
- name: Test basic import
168+
run: |
169+
python -c "import libcrypto; from libcrypto import PrivateKey, Wallet, generate_mnemonic; print('LibCrypto imported successfully')"
170170
171-
- name: Verify no external crypto dependencies
172-
run: |
173-
python -c "import sys; import libcrypto; has_ecdsa = 'ecdsa' in sys.modules; has_crypto = 'Crypto' in sys.modules; is_internal = 'libcrypto' in str(getattr(sys.modules.get('Crypto'), '__file__', '')) if has_crypto else False; assert not has_ecdsa, 'ecdsa should not be loaded'; assert not has_crypto or is_internal, 'external pycryptodome should not be loaded'; print('No external crypto dependencies')"
171+
- name: Verify no external crypto dependencies
172+
run: |
173+
python -c "import sys; import libcrypto; assert 'ecdsa' not in sys.modules, 'ecdsa should not be loaded'; print('No external crypto dependencies detected')"
174174
175-
- name: Test key generation
176-
run: |
177-
python -c "from libcrypto import PrivateKey; pk = PrivateKey(1); print(f'Public key: {pk.get_public_key().hex[:32]}...'); print('Key generation works')"
175+
- name: Test key generation
176+
run: |
177+
python -c "from libcrypto import PrivateKey; pk = PrivateKey(1); print('Public key: ' + pk.get_public_key().hex[:32] + '...'); print('Key generation works')"

src/libcrypto/cryptod/Crypto/Util/number.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,9 @@ def isPrime(N, false_positive_prob=1e-6, randfunc=None):
400400

401401
if _fastmath is not None:
402402
return _fastmath.isPrime(
403-
long(N), false_positive_prob, randfunc # noqa: F821 - long exists in Python 2
403+
long(N),
404+
false_positive_prob,
405+
randfunc, # noqa: F821 - long exists in Python 2
404406
)
405407

406408
if N < 3 or N & 1 == 0:

verify_no_deps.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ def main():
2222
crypto_file = getattr(sys.modules.get("Crypto"), "__file__", "")
2323
is_internal_cryptod = "libcrypto" in crypto_file and "cryptod" in crypto_file
2424

25-
print(f" ecdsa loaded: {has_ecdsa} {'FAIL' if has_ecdsa else 'PASS'}")
25+
print(f" ecdsa loaded: {has_ecdsa} {'FAIL' if has_ecdsa else 'PASS'}")
2626
if has_pycryptodome:
2727
if is_internal_cryptod:
2828
print(
29-
f" pycryptodome loaded: {has_pycryptodome} PASS (internal cryptod library)"
29+
f" pycryptodome loaded: {has_pycryptodome} PASS (internal cryptod library)"
3030
)
3131
else:
3232
print(
33-
f" pycryptodome loaded: {has_pycryptodome} FAIL (external dependency)"
33+
f" pycryptodome loaded: {has_pycryptodome} FAIL (external dependency)"
3434
)
3535
else:
36-
print(f" pycryptodome loaded: {has_pycryptodome} PASS")
36+
print(f" pycryptodome loaded: {has_pycryptodome} PASS")
3737

3838
# Test secp256k1
3939
print("\n2. Testing secp256k1 (pure Python)...")
@@ -46,36 +46,36 @@ def main():
4646
print(f" Private key 1 → Public key")
4747
print(f" Expected: {expected_pubkey}")
4848
print(f" Actual: {actual_pubkey}")
49-
print(f" {'PASS' if actual_pubkey == expected_pubkey else 'FAIL'}")
49+
print(f" {'PASS' if actual_pubkey == expected_pubkey else 'FAIL'}")
5050

5151
# Test random key generation
5252
print("\n3. Testing random key generation...")
5353
pk_random = PrivateKey()
5454
print(f" Generated private key: {pk_random.hex[:32]}...")
5555
print(f" Public key (compressed): {pk_random.get_public_key().hex[:32]}...")
56-
print(f" PASS")
56+
print(f" PASS")
5757

5858
# Test BIP39 mnemonic
5959
print("\n4. Testing BIP39 mnemonic...")
6060
mnemonic = generate_mnemonic()
6161
seed = mnemonic_to_seed(mnemonic)
6262
print(f" Mnemonic: {' '.join(mnemonic.split()[:4])}...")
6363
print(f" Seed: {seed.hex()[:32]}...")
64-
print(f" PASS")
64+
print(f" PASS")
6565

6666
# Test wallet
6767
print("\n5. Testing wallet address generation...")
6868
wallet = Wallet(PrivateKey(1))
6969
btc_address = wallet.get_address("bitcoin", "p2pkh")
7070
print(f" Bitcoin P2PKH address: {btc_address}")
71-
print(f" PASS")
71+
print(f" PASS")
7272

7373
print("\n" + "=" * 60)
7474
if not has_ecdsa and (not has_pycryptodome or is_internal_cryptod):
75-
print("ALL CHECKS PASSED - No external crypto dependencies!")
75+
print("ALL CHECKS PASSED - No external crypto dependencies!")
7676
print(" (Using internal cryptod library when available)")
7777
else:
78-
print("FAILED - External crypto dependencies detected")
78+
print("FAILED - External crypto dependencies detected")
7979
print("=" * 60)
8080

8181

0 commit comments

Comments
 (0)