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

  • Home
  • SEARCH
  • 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 7659043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:16:50+00:00 2026-05-31T13:16:50+00:00

This is a follow up to my previous question on showing unicode string differences

  • 0

This is a follow up to my previous question on showing unicode string differences. As it turns out the strings appear to be the same, however in one of them the UTF8 flag is on.

SV = PVMG(0x4cca750) at 0x4b3fc90
 REFCNT = 1
 FLAGS = (PADMY,POK,pPOK,UTF8)
 IV = 0
 NV = 0
 PV = 0x1eda410 "flurbe"\0 [UTF8 "flurbe"]
 CUR = 6
 LEN = 16

vs

SV = PV(0xf28090) at 0xf4b6a0
 REFCNT = 1
 FLAGS = (PADMY,POK,pPOK)
 PV = 0xf37b90 "flurbe"\0
 CUR = 6
 LEN = 16

This appears to make a difference between the resulting sha512 hashes when I encrypt the string. Dancer is what is causing the first result to have utf8 as far as I can tell, my other script is simply a command line one, without using dancer in that how can I force it to behave in the same way?

  • 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-31T13:16:51+00:00Added an answer on May 31, 2026 at 1:16 pm

    (This is more of a comment than an answer, but it’s too big.)

    I just ran this program:

    #!/usr/bin/perl -w
    
    use warnings;
    use strict;
    
    use Devel::Peek ();
    use Digest::SHA ();
    
    my $x = 'flurbe';
    
    Devel::Peek::Dump $x;
    
    print Digest::SHA::sha512_hex($x), "\n\n";
    
    utf8::upgrade $x;
    
    Devel::Peek::Dump $x;
    
    print Digest::SHA::sha512_hex($x), "\n";
    
    __END__
    

    and it gave this output:

    SV = PV(0x10441040) at 0x10491638
      REFCNT = 1
      FLAGS = (PADMY,POK,pPOK)
      PV = 0x10449ca0 "flurbe"\0
      CUR = 6
      LEN = 8
    1cd2e71e55653caeb6c9bffa47a66ff1c9b526bbb732dcff28412090601e9b5e34d36be6a0267527347cd94039b383d4bc45653d786d1041debe7faa0716bdf1
    
    SV = PV(0x10441040) at 0x10491638
      REFCNT = 1
      FLAGS = (PADMY,POK,pPOK,UTF8)
      PV = 0x10449ca0 "flurbe"\0 [UTF8 "flurbe"]
      CUR = 6
      LEN = 8
    1cd2e71e55653caeb6c9bffa47a66ff1c9b526bbb732dcff28412090601e9b5e34d36be6a0267527347cd94039b383d4bc45653d786d1041debe7faa0716bdf1
    

    As you can see, Devel::Peek::Dump correctly identifies that the string has been upgraded to UTF-8, but this doesn’t affect the SHA-512 hash computed by Digest::SHA.

    Edited to add: In a comment above, you mention that your “hashes are random salted”. Can these salts include bytes outside the ASCII range? If so, concatenation with a UTF-8-upgraded string can affect their contents. I just ran this modified program:

    #!/usr/bin/perl -w
    
    use warnings;
    use strict;
    
    use Devel::Peek ();
    use Digest::SHA ();
    
    my $x = 'flurbe';
    my $y = "\xA0";      # a single byte, hex 00A0
    my $z = "\xC2\xA0";  # UTF-8 representation of U+00A0, as a byte-string
    
    Devel::Peek::Dump "$x$y";
    print Digest::SHA::sha512_hex("$x$y"), "\n\n";
    
    Devel::Peek::Dump "$x$z";
    print Digest::SHA::sha512_hex("$x$z"), "\n\n";
    
    utf8::upgrade $x;
    
    Devel::Peek::Dump "$x$y";
    
    print Digest::SHA::sha512_hex("$x$y"), "\n";
    
    __END__
    

    and it gave this output:

    SV = PV(0x104410e8) at 0x104d68d8
      REFCNT = 1
      FLAGS = (PADTMP,POK,pPOK)
      PV = 0x10449ca0 "flurbe\240"\0
      CUR = 7
      LEN = 8
    1901f989ed76143697ecc6683fd03ec793bc126d51cdbee0a72241933136c144f2e602828abddc7e4843df5542a099be92313fa5874d1d2dc54ecdd1ff308c5e
    
    SV = PV(0x104d80b8) at 0x104ec098
      REFCNT = 1
      FLAGS = (PADTMP,POK,pPOK)
      PV = 0x10489170 "flurbe\302\240"\0
      CUR = 8
      LEN = 12
    072f7b54c80fa8062ca1d17727a88c9ff4815f83c1166471331c6398b9140a06812eff341c98453f4c51356926dbe9694cbcbebfe4cda7e77cf68008ab838c6d
    
    SV = PV(0x104d80a8) at 0x104f0f98
      REFCNT = 1
      FLAGS = (PADTMP,POK,pPOK,UTF8)
      PV = 0x104896c8 "flurbe\302\240"\0 [UTF8 "flurbe\x{a0}"]
      CUR = 8
      LEN = 12
    072f7b54c80fa8062ca1d17727a88c9ff4815f83c1166471331c6398b9140a06812eff341c98453f4c51356926dbe9694cbcbebfe4cda7e77cf68008ab838c6d
    

    As you can see, the SHA-512 hash of "$x$y" depends on whether $x was UTF-8-upgraded. "$x$y" with a UTF-8-upgraded $x gives the same SHA-512 hash as does "$x$z" with a non-UTF-8-upgraded $x. This is because SHA-512 operates on bytes, not characters, and the concatenation of a UTF-8-upgraded string with a byte-string causes the byte-string to be UTF-8-upgraded.

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

Sidebar

Related Questions

This is a follow up question from my previous one found here I need
This is a follow up on a previous question...I was helped out adapting my
this is a follow up question from my previous one. you can find it
This is a follow up question to a previous question I asked about calculating
This is a follow-up to a previous question I had about interfaces. I received
This is a follow up to my previous question: Problem passing parameters via Iframe
This is a follow on to my previous question: JSP / servlet / IE
This is a follow on from my previous question although this is about something
This is a follow-up to my previous question . I still find it very
This is a follow up to my previous question . My code is still

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.