Class: Synthra::Types::TextContent::Md5

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/text_content/security.rb

Overview

Md5 type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



68
69
70
# File 'lib/synthra/types/text_content/security.rb', line 68

def generate_edge(rng, context, args)
  ["00000000000000000000000000000000", "ffffffffffffffffffffffffffffffff"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



72
73
74
# File 'lib/synthra/types/text_content/security.rb', line 72

def generate_invalid(rng, context, args)
  [nil, "not a hash", "invalid", [], {}].sample(random: rng.instance_variable_get(:@random))
end

#generate_random(rng, context, args) ⇒ Object



62
63
64
65
66
# File 'lib/synthra/types/text_content/security.rb', line 62

def generate_random(rng, context, args)
  # Generate 32-character hex MD5 hash
  chars = ('0'..'9').to_a + ('a'..'f').to_a
  32.times.map { rng.sample(chars) }.join
end