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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:58:03+00:00 2026-05-16T06:58:03+00:00

<?php $file = ‘file.dat’; $file_contents = file_get_contents($file); for ($i = 0x000481; $i <= 0x00048B;

  • 0
<?php
$file = 'file.dat';
$file_contents = file_get_contents($file);
for ($i = 0x000481; $i <= 0x00048B; $i++) {
print $i;
}
?>

I am creating an online file analyzer but I have a small problem. It outputs (which is the actual position the hex is in)

1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163

when it should be

44 72 48 79 64 72 61 6C 69 73 6B

which his hex for DrHydralisk (me). Can anyone help me output the latter or just have it strait output ASCII (but hex is fine, I can just convert it)?

edit

Here is an image of what I am trying to do that I think will help.

https://i.stack.imgur.com/TORd3.png

Here is the file I am trying to read, its a Starcraft replay (file.SC2Replay). Just search for DrHydralisk in a hex editor and that is where I am trying to read from.

http://www.mediafire.com/?6w8wi35q3o6ix8q

  • 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-16T06:58:04+00:00Added an answer on May 16, 2026 at 6:58 am

    It should be (if clear text is in the file):

    for( $i=0x481; $i<0x48D; $i++ ) {
       printf("%X ", ord($file_contents[$i]));
    }
    

    Note the loop boundaries: 0x481 .. 0x48D

    Result:

    44 72 20 48 79 64 72 61 6C 69 73 6B 
    

    If the file contains hexadecimal numbers, this would be impossible because you need two bytes per hex char for the ascii character value range. So what is really in the file?


    Edit

    After reading your file, i did:

    ...
    
    $file = 'file.SC2Replay';
    $file_contents = file_get_contents($file);
    
    for( $i=0x438; $i<0x443; $i++) {
       printf("%X ", ord($file_contents[$i]));
    }
     for( $i=0x438; $i<0x443; $i++) {
       printf("%s ", $file_contents[$i]);
    }
    
    ...
    

    And it says:

    72 48 79 64 72 61 6C 69 73 6B 
    

    and

    D r H y d r a l i s k 
    

    You messed up the file position 😉

    Regards

    rbo

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

Sidebar

Related Questions

With php file_get_contents() i want just only the post and image. But it's get
I have php file with form which the user need to enter three parameters
In php I have open a .php file and want to evaluate certain lines.
I have an index.php file which has to process many different file types. How
i have a php file launching my exe. the exe does cout and the
I have a PHP file which inserts $mail and $password in my database. See
I have a php file that has some local and global variables (e.g. $foo)
I have a php file i created. I want to extend all the Joomla!
I have a php file that is only accessed through ajax. The ajax call
I have a PHP file with PHP Variables inside. Example: Hi <?=$username?>, Can you

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.