Java equals method and encrypted Strings

Tastybrownies

I've run into a very strange circumstance and figured I would post here because I have no clue what's wrong. I have developed this android app that involves passwords and I have a user with a saved encrypted AES string saved to a file. When a user logs into the system again with their password I need to see whether it equals the encrypted on already in the file.

So I grabbed it and tried to compare the two strings using the .equals method like always and to my surprise it didn't work.

Here are the two strings: What am I missing? Any help would be greatly appreciated since I don't even have an first step on how to solve this. I also tried compareTo == 0 and it didn't work either.

Thank you very much!!!

The first string is from the file, the second is the encrypted version of the password the user just entered:

o0JkTVCBcbZnePszCKp64/cOJx/W/dud/xszfvNjwGk=

o0JkTVCBcbZnePszCKp64/cOJx/W/dud/xszfvNjwGk=
Maarten Bodewes

Base64 encoding is used to encode binary data into strings; the base64 string is not the data itself. To compare the data in the strings, first decode it to a byte array, then compare the byte arrays using the utility function in the Java Arrays class. This should avoid issues with e.g. white space both in and around the encoding.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Java equals method and encrypted Strings

From Dev

Comparing Strings in Java .equals()

From Dev

overriding the equals method in java

From Dev

Equals method not working Java

From Dev

Java Equals Method

From Dev

How to override hashcode and equals method to avoid adding duplicate strings in HashSet in java?

From Dev

Overriding Proper Java equals method

From Dev

how equals method works in java

From Java

Java code related to equals method

From Dev

Overriding hashcode and equals method in java?

From Dev

Java Method equals circular list

From Dev

Overriding Proper Java equals method

From Dev

Java Equals Method doesnt work

From Dev

Java Method equals circular list

From Dev

how equals method works in java

From Dev

Overriding .equals() method (== returned true while comparing Strings)!

From Dev

Python's method like 'equals' in Java

From Java

Relationship between hashCode and equals method in Java

From Dev

Java Faster Equals method For float type

From Dev

Java String Comparison is failing, using equals method

From Dev

Canonical equals() method for Java as on Android Developers site

From Dev

Java - method equals and more possible letters

From Dev

Equals method in Joshua Bloch's Effective Java

From Dev

any alternative to overriding "equals()" method in java?

From Dev

Generic classes in java and equals() method: type safety

From Dev

Why is the .equals() method not overriden for arrays of primitives in Java?

From Dev

Java 8 distinct() does not invoke the equals method

From Dev

Java - method equals and more possible letters

From Dev

Java String comparison not working with .equals( ) method

Related Related

HotTag

Archive