CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/lib/rex/crypto/rc4_spec.rb
Views: 1904
1
require 'spec_helper'
2
require 'securerandom'
3
4
5
RSpec.describe Rex::Crypto do
6
7
describe '#rc4' do
8
9
let(:key) {
10
SecureRandom.random_bytes(32)
11
}
12
13
let(:value) {
14
'Hello World'
15
}
16
17
it 'encrypts a string' do
18
expect(Rex::Crypto.rc4(key, value)).not_to eq(value)
19
end
20
21
it 'decrypts a string' do
22
encrypted_str = Rex::Crypto.rc4(key, value)
23
decrypted_str = Rex::Crypto.rc4(key, encrypted_str)
24
expect(decrypted_str).to eq(value)
25
end
26
27
end
28
end
29