forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

What is NID, how I could get and why

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
bubugian



Joined: 09 Oct 2008
Posts: 18

PostPosted: Thu Aug 13, 2009 7:01 pm    Post subject: What is NID, how I could get and why Reply with quote

Hi all,
I'm new with psp programming so, please be patient if my questions are banal.

In some posts I found some reference to NID.
Seems that NID is used for hooking sce function.

I'm not sure to have understood so, I'm going to post some simple answer:

- What is NID ?
- Where is NID (how I discover it, with wich tools) ?
- Why I shoud hook a sce function ?
- How I coul hook a function ?

Thanks all !
Back to top
View user's profile Send private message
slasher2661996



Joined: 22 Feb 2009
Posts: 91
Location: Melbourne Australia ZOMG

PostPosted: Thu Aug 13, 2009 7:51 pm    Post subject: Reply with quote

Q1: Well, a nid is the memory address 0x000000 etc. to a reference to a firmware function

Q2: http://silverspring.lan.st/

Q3: You should hook a function is you want to track the usage, do something before the function executes etc.

Q4: Search this forum "easy hook example"
Back to top
View user's profile Send private message
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Thu Aug 13, 2009 8:48 pm    Post subject: Reply with quote

Q1: A NID is just a 32-bits function ID for the kernel to recognize it and resolve it on the ELF imports. It's the SHA1 hash for the function name. Each NID is unique (hopefuly) and it's related to an export library, which in turn is related to PRX modules.
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.


Last edited by m0skit0 on Thu Aug 13, 2009 8:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
slasher2661996



Joined: 22 Feb 2009
Posts: 91
Location: Melbourne Australia ZOMG

PostPosted: Thu Aug 13, 2009 8:49 pm    Post subject: Reply with quote

m0skit0 wrote:
Q1: NID is just a function ID for the kernel to recognize it and resolve it on the ELF imports. It's the SHA1 hash for the function name.


That, i didn't know ;)
Back to top
View user's profile Send private message
Dariusc123456



Joined: 12 Aug 2008
Posts: 394

PostPosted: Fri Aug 14, 2009 4:33 am    Post subject: Reply with quote

m0skit0 wrote:
Q1: A NID is just a 32-bits function ID for the kernel to recognize it and resolve it on the ELF imports. It's the SHA1 hash for the function name. Each NID is unique (hopefuly) and it's related to an export library, which in turn is related to PRX modules.


A nid isn't really "unique" for each function since its some of the nids are randomize since 3.71 (or 3.60 i think). Only some of the nids are a 32 bit ID sha-1 (including in the unofficial pspsdk).
_________________
PSHN - Playstation Hacking Network
PSX/PS1 - HACK - Game Shark
PS2 - HACK - Swap
PSP - HACK - Pandora
PS3 - ?
Back to top
View user's profile Send private message AIM Address
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Fri Aug 14, 2009 5:24 am    Post subject: Reply with quote

I think you meant only some functions got their NID randomized. You can try this links to see what i'm saying:

Function name & NID for 5.00 FW:
http://prxlibdocs.dark-alex.org/5.00/index.html

Online SHA1 calculator
http://sha1-hash-online.waraxe.us/

Take any resolved function name (that is, things like sceUsbBus_driver_48CCE3C1 are just library name + NID and not the real function name, so it doesnt work), put it in the text box, click "calculate hash" button and compare first 4 bytes of hash to function's NID in reverse order: compare first byte of hash with last byte of NID and so on.

Let me know when you find one that doesn't coincide.
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri Aug 14, 2009 5:50 am    Post subject: Reply with quote

All NIDs used to be just the SHA1 hash of the function name... emphasis on used to be. User functions still are since Sony clearly can't change the user functions. However, in an effort to defeat custom firmware, Sony started randomizing the kernel function NIDs starting at 3.70. Not all kernel functions either, just many of the ones custom firmware relies on.

So user function NIDs will still match the SHA1 hash of the name, but many of the kernel function NIDs won't.
Back to top
View user's profile Send private message AIM Address
Dariusc123456



Joined: 12 Aug 2008
Posts: 394

PostPosted: Fri Aug 14, 2009 7:21 am    Post subject: Reply with quote

Could it be possible that Sony is using the sha-1 but added on some random numbers to confuse cfw/homebrew developers?
_________________
PSHN - Playstation Hacking Network
PSX/PS1 - HACK - Game Shark
PS2 - HACK - Swap
PSP - HACK - Pandora
PS3 - ?
Back to top
View user's profile Send private message AIM Address
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Fri Aug 14, 2009 10:31 pm    Post subject: Reply with quote

You think?! Genius!
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group