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 6010511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:07:36+00:00 2026-05-23T02:07:36+00:00

i was trying to make a simple little password program (to further expand my

  • 0

i was trying to make a simple little password program (to further expand my knowledge) and i just can’t get it to work. the problem is even though i enter the correct password it will not jump to the label “good”.

my way of validating the password is to xor the built in password with the user submitted one and if it returns 0 that means they are the same. (because anything xor’d by itself is 0)

so my mistake is most likely within the cmpl and je commands or within my xoring itself. any help would be nice i simply can’t find my mistake.

.section .data

hmm:
.ascii "Enter the password\n\0"

password:
.ascii "abgirl"

success:
.ascii "Password is right\n\0"

bad:
.ascii "password is wrong\n\0"

.section .bss

.equ buffer_size, 500

.lcomm buffer_data, buffer_size

.section .text

.global _start

_start:

pushl $hmm
call printf                      #print $hmm

movl $0, %ebx
movl $buffer_data, %ecx
movl $buffer_size, %edx
movl $3, %eax
int $0x80                        #get user input

movl $password, %eax
xorl $buffer_data, %eax          #xor the passwords (value stored in eax)

cmpl $0, %eax                    #compare
je good                          #jump if equal

pushl $bad
call printf                      #print bad pass if not equal
jmp end                          #jump to exit

good:
pushl $success
call printf                      #print $success

end:
movl $0, %ebx
movl $1, %eax
int $0x80                        #cleanup and exit
  • 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-23T02:07:37+00:00Added an answer on May 23, 2026 at 2:07 am

    Your problem is the comparison.

    movl $password, %eax
    xorl $buffer_data, %eax
    

    The dollar signs mean you are working with the addresses of the variables, not the contents. Since the password and buffer are at different locations, the comparison will always be false. What you want is to compare the character in each position of the password and buffer. To do this, you will need to know how long the password is.

    password:
    .ascii "abgirl\0"
    .set password_len, . - password
    

    Notice that I also added a null byte to your password, so that the comparison will fail if the input password is longer. Now, you need to change your comparison to check each byte.

        movl $password, %ebx
        movl $buffer_data, %edx
        movl $password_len, %ecx
    0:
        movb (%ebx), %al
        xorb (%edx), %al
        jnz bad
        inc %ebx
        inc %edx       # Go to next byte
        dec %ecx
        jnz 0b
        jmp good
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to make a little simple game just to test my logics,
Trying to make simple minesweeper game in python, but have one problem. I have
Trying to make a simple program to catalogue books. Something like this, for example:
Trying to make a simple program to catalogue books. Something like this, for example:
I'm trying to make a simple website using mvc but I'm a little confused
I'm trying to compile a simple little test program. and I'm getting errors: MacBook-Air:Untitled
i am trying to make a very simple program that invert the pixels position
I'm trying to make a simple blackjack program. Sadly, I'm having problems right off
A little context: I'm trying to make a very simple hashing function/hash table as
I'm trying to make a little java program that executes a system command but

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.