User Profile

Collapse

Profile Sidebar

Collapse
gulyan
gulyan
Last Activity: Oct 4 '08, 07:00 PM
Joined: Aug 13 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • gulyan
    started a topic php array help
    in PHP

    php array help

    Hy,

    I want to use an array tu transform from base 64 to decimal.
    The problem is the function always returns 0... :(
    The reason is that $digit64[$str[$i++]] is always 0 but i don't know why.
    $str[$i++] is 'B' just as it should but $digit64[$str[$i++]] is 0;
    if i try with $digit64['B'] the result is 11 (11 is the corect result);
    Please help.
    Thx in advance


    Code:
    $digit64
    ...
    See more | Go to post

  • gulyan
    replied to MIni search engine
    in PHP
    To make a very simple crawler you can use php. You begin with a web page (home page probably). You download the page using php sockets. You put the content in a variable and treat it as a string. You search for links to other pages in that string. What I mean is that you search for something like this:
    Code:
    <a href="www.link.com">link</a>
    You then apply the same method with each link. I think you will nead to use a boolean...
    See more | Go to post

    Leave a comment:


  • gulyan
    replied to Reverse the string..
    in C
    do you mean you have a string, something like:
    Code:
    char str[] = "just a string";
    and you need to revers it with only one variable?
    if so you might try something like this:
    Code:
    Code removed per Posting Guidelines
    this way the only variable you use is "i" fot the indexing.
    this is a little absurd ... you have to calculate the length of str 5 times for every character. it...
    See more | Go to post
    Last edited by sicarie; Aug 18 '08, 01:08 AM. Reason: Spoonfeeding code removed - OP has not contributed ANYTHING to this conversation aside of 1st post

    Leave a comment:


  • gulyan
    replied to Convert any number into USD
    try this function:

    Code:
    function NumberToUSD(input)
    {
    	var nr = new Number(input);
    	var str = new String();
    	str = nr.toString();
    	var a = str.indexOf('.');
    	var p2 = str.substr(a, str.length) + '$';
    	var p1 = str.substr(0, a);
    	a = p1.length;
    	switch (a%3)
    	{
    		case 0:break;
    		case 1:str = p1.substr(0,1);p1 = p1.substr(1,p1.length-1);break;
    ...
    See more | Go to post

    Leave a comment:


  • gulyan
    replied to SHA-1 algorithm help
    in C
    Thx Banfa and archonmagnus for your help :D

    I changed the ! to ~ and rewrote the macro.

    With the last sugestion of using unsigned when converting, the algorithm finaly works. Thx again :D

    This is the final algorithm.. maybe it can help someone else as well
    Code:
    unsigned long ROTL(long a, long b)
    {
    	return (a<<b)|(~(0xFFFFFFFF<<b)&(a>>(32-b)));
    }
    ...
    See more | Go to post

    Leave a comment:


  • gulyan
    replied to SHA-1 algorithm help
    in C
    thx again, I've made tha changes in the program

    Code:
    long bitLength = length * 8;
    and
    Code:
    for(j=i;j<i+64;j+=4)
    		{
    			w[(j-i)/4] = buff[j] << 24;
    			w[(j-i)/4] |= buff[j+1] << 16;
    			w[(j-i)/4] |= buff[j+2] << 8;
    			w[(j-i)/4] |= buff[j+3];
    		}
    After the first run through the loop, w[0] is 1416127776 wich is 01010100 01101000...
    See more | Go to post

    Leave a comment:


  • gulyan
    replied to Help need with icon
    in C
    have a look at this http://msdn.microsoft.com/en-us/visualc/cc512459.aspx
    See more | Go to post

    Leave a comment:


  • gulyan
    replied to get data from web
    in C
    have a look at this http://msdn.microsoft.com/en-us/visualc/bb985511.aspx
    See more | Go to post

    Leave a comment:


  • gulyan
    replied to SHA-1 algorithm help
    in C
    thx for the reply :D
    I've made changes to the code and also found that i was using "i" inside the for wich used it as an index....

    I'm a little confuze about big and little endians

    after the firs run through the loop, w[0] contains " ehT" not "The" .. so i gues this is a little endian.

    Code:
    for(j=i;j<i+64;j+=4)w[(j-i)/4] = *((long*)(buff+j));
    How can I...
    See more | Go to post

    Leave a comment:


  • gulyan
    replied to SHA-1 algorithm help
    in C
    thx for the reply

    Code:
    unsigned long ROTL(unsigned long a, unsigned long b)
    {
    	return (a<<b)|(a>>(32-b));
    }
    should do the same thing as
    Code:
    #define ROTL ( a , b ) ( ( ( b ) << a ) | ( ( b ) >> ( 32 - a ) ) )
    but my problems are not compiler errors :(
    btw.. I'm using vc++
    See more | Go to post

    Leave a comment:


  • gulyan
    started a topic SHA-1 algorithm help
    in C

    SHA-1 algorithm help

    Hi, I'm trying to make the sha-1 algorithm based on the wikipedia pseudocode.
    For the 'The quick brown fox jumps over the lazy dog" string I should get
    2fd4e1c6 7a2d28fc ed849ee1 bb76e739 1b93eb12 but what I get is
    1D8B8841 A544939A 98BB54FE 4C325476 C44AE1F0
    (after I convert from dec to hex)
    I have no idea what the problem is :(
    Thx in advance
    Code:
    #define ROTL ( a , b ) ( ( ( b
    ...
    See more | Go to post
No activity results to display
Show More
Working...