Equational unification : algorithms and complexity with applications to cryptographic protocol analysis