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/spec/lib/rex/crypto/rc4_spec.rb
Views: 11784
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