Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

257
Vistas
Base 64 decoding a string in Ruby on Rails

I'm completely new to ruby-on-rails, I just want to write a small rb programming code that will take input as a string(encoded password), then it will decode the string and return it to the caller. I was trying the below code but not sure what I'm doing, here my purpose of having this code is to use it as a plugin in fluentd.

def create_base_64 
  
base64_string = "67382hfuisab3y289321787123890......"

decoded_data = StringIO.new(Base64.decode64(base64_string))

end

In case you are posting the code, could you please provide me with some online programming tool where I can test it online.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

#!/usr/bin/env ruby

require 'base64'

def decode_string(encoded_string)
  begin
    Base64.decode64(encoded_string)
  rescue
    puts 'Not a base64 string'
    exit
  end
end

if ARGV.length != 1
  puts 'Missing argument'
  exit
end

puts decode_string(ARGV[0])
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda