My Math Forum PLEASE, which programming language is that?

 Computer Science Computer Science Forum

 May 10th, 2014, 08:52 AM #1 Senior Member   Joined: Oct 2012 Posts: 460 Thanks: 0 PLEASE, which programming language is that? Hello! This is the code for djb2 (hash) function! Please, can someone tall me WHICH PRORAMMING LANGUAGE IS THAT? Sorry for very begiiner questiin! Many thanks!!! unsigned long hash(unsigned char *str) { unsigned long hash = 5381; int c; while (c = *str++) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ return hash; }
 May 10th, 2014, 08:57 AM #2 Senior Member   Joined: Dec 2013 From: Russia Posts: 327 Thanks: 108 Looks like C. Thanks from ungeheuer
 May 10th, 2014, 09:35 AM #3 Senior Member   Joined: Oct 2012 Posts: 460 Thanks: 0 Hello! Hello! C++ could also be?
May 10th, 2014, 09:41 AM   #4
Senior Member

Joined: Dec 2013
From: Russia

Posts: 327
Thanks: 108

Quote:
 Originally Posted by ungeheuer C++ could also be?
Could be.

 September 30th, 2014, 04:09 PM #5 Newbie   Joined: Sep 2014 From: london Posts: 5 Thanks: 0 agreed c or c++ most likely also might be d as well but im not sure about that!
 October 26th, 2014, 04:45 AM #6 Newbie   Joined: Oct 2014 From: France Posts: 2 Thanks: 0 It's either C or C++. That is to say, it could be used in both programming languages. In C++, the use of object orientation is more common and you will often see functions written as class::hash(unsigned char* str). Object orientation cannot be used in C, which is one of the main differences between the two programming languages. Part of the program is missing (it's only the function), full program could be: Code: #include unsigned long hash(unsigned char *str) { unsigned long hash = 5381; int c; while (c = *str++) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ return hash; } int main() { printf("%d \n", hash("hello world") ); }

 Tags language, programming

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post johnr New Users 4 September 3rd, 2013 06:02 PM token22 Computer Science 4 September 22nd, 2012 12:00 PM Redneck_country_girl Algebra 5 May 18th, 2011 10:23 PM parasio Computer Science 2 May 13th, 2009 07:33 PM autumnangel Algebra 1 February 22nd, 2009 02:39 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top