Skip to content
Snippets Groups Projects
Commit a4285ed0 authored by Guillaume Valadon's avatar Guillaume Valadon
Browse files

Merge pull request #120 from p-l-/fix-crypto-import

Python 2.5: fallback implementation for gcd() without pycrypto
parents 73361674 b977886d
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,22 @@ True
import socket
import struct
from Crypto.Util.number import GCD as gcd
try:
from Crypto.Util.number import GCD as gcd
except ImportError:
try:
from fractions import gcd
except ImportError:
def gcd(a, b):
"""Fallback implementation when Crypto is missing, and fractions does
not exist (Python 2.5)
"""
if b > a:
a, b = b, a
c = a % b
return b if c == 0 else gcd(c, b)
from scapy.data import IP_PROTOS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment