Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:03:29+00:00 2026-05-26T23:03:29+00:00

Help, I am a noob, just need some advice on this bit of code.

  • 0

Help, I am a noob, just need some advice on this bit of code. I have got most of my program working this part has me stuped i want to get a name and password. Then make the name the key and the password the value. Now it must be user defined.. Then I must be able to pull that hash info again. I thought that return would work… here is my code

  def login_prompt
  vault = {}
     puts "WELCOME! please enter an existing username: "
     username = gets.chomp
     checkname = Noxread.new
     comparename = checkname.read_file
     comparename.keys.include?("#{username}") 
     if comparename == true
       puts "please enter your password: "
       password = gets.chomp
       vault[username]= password
       else puts "username already exists!! would you like to retry? (y/n)"
       case answer
     when /^y/
         login_prompt
     when /^n/
     exit
       end
     end
 end

so that should gather the info. and this is my code to merge that and an hash that i pulled from a file. in a NoxRead class

require_relative ‘read’
require ‘csv’

 class Noxwrite
  attr_accessor :name :password  

  def initialize  
    @name = name 
    @password = password
  end

  def upsum

    x = Noxread.new
    y = x.read_file
    z = login_prompt
    y.merge(z) {|name, password| name + ',' + password}
    return y

   end

    def write_file

    ehash = upsum
    CSV.open("data.csv", "wb") do |csv|
    csv << ehash
    end

  end

end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:03:30+00:00Added an answer on May 26, 2026 at 11:03 pm

    What is the problem with this code. Seems fine, apart from the fact that passwords should not be read like this in open text.

    When you write something like

    user_hash = login_prompt

    user_hash will have the hash as desired

    {"username"=>"password"}

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Java, and I need some help working on this program. This
I need help understanding how to implement this part of PHP code in Ruby.
I'm a SQL noob, and I need a little bit of help understanding the
I am a delphi noob so please help me out with this. I have
I am a javascript noob and I need help with this problem ! On
I guess this is just a simple question (I’m such a noob…) I have
I need some help creating a query for my mySQL database. I have recently
HELP! I just setup a virtual host for two sites that have a lot
I'm a c# noob but I really need a professional's help. I am using
I'm a real noob who just started learning 3d programming and i have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.