CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/proto/kerberos/crypto/utils.rb
Views: 11766
1
module Rex
2
module Proto
3
module Kerberos
4
module Crypto
5
module Utils
6
def xor_strings(s1,s2)
7
l1 = s1.unpack('C*')
8
l2 = s2.unpack('C*')
9
result = xor_bytes(l1, l2)
10
result.pack('C*')
11
end
12
13
def xor_bytes(l1,l2)
14
result = []
15
l1.zip(l2).each do |b1,b2|
16
if b1 != nil && b2 != nil
17
result.append((b1^b2))
18
end
19
end
20
21
result
22
end
23
end
24
end
25
end
26
end
27
end
28
29