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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:20:22+00:00 2026-05-18T05:20:22+00:00

I have java code that prepares a message for a MD5 munge private static

  • 0

I have java code that prepares a message for a MD5 munge

private static char[] jimsCopyRight = {

‘C’, ‘o’, ‘p’, ‘y’, ‘r’, ‘i’, ‘g’, ‘h’,
‘t’, ‘:’, ‘ ‘, 0xa9, ‘ ‘};

which is used in

StringBuffer message = new StringBuffer();

message.append(name.toLowerCase());
message.append(new String(jimsCopyRight));

When I print out the message using

for(int i = 0; i < message.length(); i++){

System.out.println(” i = ” + i + ” char ” + message.substring(i, i + 1) + ” charAT ” + message.charAt(i));
}

I get i = 14 char \251 charAT \251 and the message.toString is jimCopyright: \251

I need to construct a NSMutableString with the same characters.

Among the things I have tried

wDevCopyright = [NSString stringWithFormat:@"jimCopyright: %c ", 0xa9];
for(int i = 0; i < [message length]; i++){
  NSLog(@"i = %d char %c %d", i, [message characterAtIndex:i], [message characterAtIndex:i]);
 }

Which gives me i = 14 char © 169

Any help in getting the NSMutableString to be the same as the StringBuffer will be appreciated.


The problem is that when I munge the two strings in MD5 I get different results when I add the 0xa9. The prints are just for getting a look at the strings.

I’m thinking it has something to do with the char[] in Java and the construct of the NSMutableString. I do not believe they are the same values.

I have some C code and it declares the copyright as

#define jimsCopyRight  "Copyright: � "

The Java MD5 and C MD5 of the copyright are the same.

  • 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-18T05:20:22+00:00Added an answer on May 18, 2026 at 5:20 am

    The copyright symbol is what you wanted, right? According to your question, that’s what you got. So what’s the problem?

    (This is why magic numbers are bad. I can’t tell from your code alone what encoding’s 0xa9 you wanted.)

    If you’re wondering why it says 169 instead of 251, it’s because Java prints out the octal (base-8) character escape sequence, whereas %d in the C standard library, Core Foundation, and Foundation prints out the value as decimal (base-10). \251 is not the two hundred and fifty-first character. Use %o to print the value as octal, or %x to print it as hexadecimal (base-16). Or, use Calculator.app’s Programming mode to convert 251 from octal to decimal.

    BTW, you can use the %@ format sequence and the NSUserName function to insert your username into the string, just like you did in the Java code. No need to hard-code it.

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

Sidebar

Related Questions

Let's say I have some Java code: public class SomeClass { static { private
I have some Java code that uses curly braces in two ways // Curly
I have a java script code that works fine when run through a browser,
I have a standalone Java app that has some licensing code that I want
I have to take over and improve/finish some code that transforms Java objects from
I have to ship some groovy code to some users that have only java
I have this java code: <script src=http://www.google.com/jsapi></script> <script type=text/javascript> google.load(jquery, 1.2.6); $(a#more).click(function() { $(#info_box).show(blind,
I'm using Eclipse 3.4 and have configured the Java code formatter with all of
I have the following Java 6 code: Query q = em.createNativeQuery( select T.* +
In Eclipse IDE how do you customize the Java code style formatter to have

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.