score:1
i will speak to the java side; i believe the same comments apply to the c version as well.
you do not want to take your encrypted byte array and convert it to a string. in particular, here:
byte[] encvalue = cipher.dofinal(valuetoenc.getbytes());
return new string(encvalue);
the problem is that new string(byte[] b)
is going to interpret the byte array as a string that is encoded with the default encoding. of course, the byte array is not an encoded string, so this isn't particularly useful.
if you want to get a string that you can use to compare the encrypted byte arrays (visually), the typical approach is to hex-encode the byte array. see how to convert a byte array to a hex string in java? and how do you convert buffer (byte array) to hex string in c? for more information. there are, of course, many libraries that support this functionality.
Source: stackoverflow.com
Related Query
- AES string encryption/decryption in C and java
- Eclipse : key on Android AES encryption and decryption
- Checkstyle and Eclipse; Java string continuation
- Eclipse git plugin and a method to fetch current branch - commit id to Java code version info string
- Align predefined text to left and display string aligned to the right. Java
- Paste a multi-line Java String in Eclipse
- What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?
- What is the difference between Eclipse for Java (EE) Developers and Eclipse Classic?
- Java Eclipse: Difference between exporting as a JAR and exporting as a Runnable JAR
- Java 8: Formatting lambda with newlines and indentation
- Java "constant string too long" compile error. Only happens using Ant, not when using Eclipse
- Java - Build and run eclipse project from command line
- What is the use of Order And Export tab in Java Build Path
- Incompatible JVM in GGTS (Eclipse) and JAVA 1.8
- Eclipse Java error: This selection cannot be launched and there are no recent launches
- CLASSPATH, Java Buld Path (eclipse), and WEB-INF\LIB : what to use, when, and why?
- Difference between Java working set and Resource working set in Eclipse
- How to create an Intellij and Eclipse compatible code style and code formatting configuration (for java code)?
- Java Dynamic Web project with Maven and Eclipse
- What is the difference between Eclipse and Netbeans if I want to use only the Java in it?
- Jersey: A message body writer for Java Class and MIME mediatype application/json was not found
- I updated java and eclipse does not work
- Is there any way I can write (copy-paste) nicely-formatted SQL queries in Java string literals using Eclipse?
- Simple program to call R from Java using Eclipse and Rserve
- How do I import a pre-existing Java project into Eclipse and get up and running?
- Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules
- How can I parse both Java and C++ in Eclipse?
- Simultaneous Java and Scala development within the same project
- Is it possible to have CDT and Java IDE together in Eclipse?
- Kotlin And Java In The Same Project Using Eclipse IDE
More Query from same tag
- "The type javax.el.ValueExpression cannot be resolved" error when extending checkbox related jsf components
- How to randomely display images when the activity starts
- Java - special characters in file names
- getServletContext().getRealPath("/") return wrong path
- Running a specific project when I hit Run in eclipse
- Java JDBC connection to MySQL
- Cannot access Tomcat from Eclipse in Ubuntu
- Eclipse GDT: undefined reference to library components
- JAXB class eclipse wizard didn't generate enums
- How to configure behavior of the "assign parameter to new field" quickfix in eclipse?
- Having multiple projects in tabs like Eclipse? [IntelliJ]
- java.lang.NoClassDefFoundError occures using tess4j without Eclipse
- PyDev Install Issue. (PyDev/Eclipse)
- Bar Chart and Stacked Bar Chart using similar data on one page
- How can I run my own java code in the JVM that I am debugging remotely with JDWP?
- Where is the Eclipse's preferences stored locally?
- Debug eclipse plugin project -- PermGen space, out of memory error
- In Eclipse, how to know which parameter is the cursor on a Java Method?
- How to control the size of MasterDetailsBlock component in Eclipse RCP?
- Investigate a data structure in Java with Eclipse
- How can I reset eclipse to default settings?
- Is it possible to recover classes source code from Maven jar?
- Adding referenced libraries to /lib folder in Eclipse
- Choosing SDK version to reach maximum number of people
- maven issue ArtifactDescriptorException
- Creating jar executable w/ external jar (JXL) in ECLIPSE java
- Struggling with managing my eclipse workspace and what to do about syncing it between two machines
- Error when attempting to connect to local Database
- Bottom actionbar like in Instagram
- Project Specific Tasks - Eclipse