Raised This Month: $12 Target: $400
 3% 

[INC] Crypt


Post New Thread Reply   
 
Thread Tools Display Modes
k1nader
Junior Member
Join Date: Dec 2009
Location: China.四川
Old 11-12-2012 , 00:26   Re: [INC] Crypt
Reply With Quote #11

for delphi
PHP Code:
function EncryptString(szSourceszKeystring): string;
var
  
iKeyPosiPosInteger;
  
szDeststring;
begin
  szDest 
:= szSource;

  
iKeyPos := 1;
  for 
iPos := 1 to Length(szSource) do
  
begin
    szDest
[iPos] := Char(ord(szSource[iPos]) xor ord(szKey[iKeyPos]));

    
iKeyPos := iKeyPos 1;

    if 
iKeyPos Length(szKeythen
      iKeyPos 
:= 1;

  
end;
  
Result := szDest;
end
k1nader is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 03-24-2014 , 10:36   Re: [INC] Crypt
Reply With Quote #12

Bugsy , sorry for bumping this old thread , but i'm getting segmentation fault with C code! ( I try to run this in ubuntu 12.04 LTS )

Code:
#include <stdio.h> #include <string.h> void CryptString( char *szString , unsigned int iSize , const char *szKey ) {         if( !iSize )             return;         const char *szTmpKey = szKey;         while( iSize-- )         {             *szString = *szString++ ^ *szKey++;             if( !*szKey )                 szKey = szTmpKey;         } } int main( int argc, char* args[] ) {     argc = 5;     if( ( argc - 1 ) == 4 )     {         args[0] = "hi bitches";         args[1] = "--key";         args[2] = "2";         args[3] = "--string";         args[4] = "1";         int iKey = 0 , iString = 0, i;         for( i = 0 ; i < 5; i++ )         {             if( iKey != 0 && iString != 0 )                 break;             if ( strcmp(args[i], "--k") == 0 || strcmp(args[ i ], "-key") == 0)             {                 iKey = i;             }             if ( strcmp(args[ i ],"--s") == 0 || strcmp(args[ i ],"--string") == 0)             {                 iString = i;             }         }         if( iKey = 0 || iString == 0 )         {             printf( "No se encontraron los parámetros correspondientes\n" );             printf( "[ --k , -key ] - [ --s , -string ] \n" );         }         else         {             int ilen = strlen( args[ iString + 1 ] );             printf( "==========================\n" );             printf( "Key = %s\n" , args[ iKey + 2 ] );             printf( "Texto ingresado = -%s- \n", args[ iString + 1 ] );             CryptString( args[ iString + 1 ] , ilen, args[ iKey + 2 ] );             printf( "Texto saliente =  -%s- \n" , args[ iString + 1 ] );             printf( "==========================\n" );         }     }     else     {         printf( "4 (Cuatro) parámetros requeridos! \n" );         printf( "[ --k , -key ] - [ --s , -string ] \n" );     } }
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 03-25-2014 , 11:08   Re: [INC] Crypt
Reply With Quote #13

I'm not a C developer but it worked under Ubuntu...
PHP Code:
#include <stdio.h>
#include <string.h>
void CryptString(char *szString unsigned int iSize , const char *szKeychar output[]){
    if(!
iSize){
        return;
    }
    const 
char *szTmpKey szKey;
    
char szTempString[iSize];
    
int iPos 0;
    while(
iSize--){
        
szTempString[iPos] = *szString++ ^ *szKey++;
        
iPos++;
        if(!*
szKey){
            
szKey szTmpKey;
        }
    }
    
output szTempString;

int mainint argccharargs[] ){
    
char *test "test";
    const 
char *key "key";
    
char output[32];
    
CryptString(teststrlen(test), keyoutput);
    
printf("%s\n"output);

__________________

Last edited by Neeeeeeeeeel.-; 03-25-2014 at 11:08.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Indianos
BANNED
Join Date: Mar 2016
Location: https://t.me/pump_upp
Old 12-28-2016 , 04:39   Re: [INC] Crypt
Reply With Quote #14

Are these functions giving exactly same as php: crypt (link)??
Indianos is offline
Send a message via ICQ to Indianos Send a message via AIM to Indianos Send a message via Yahoo to Indianos
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-25-2017 , 12:11   Re: [INC] Crypt
Reply With Quote #15

Quote:
Originally Posted by Indianos View Post
Are these functions giving exactly same as php: crypt (link)??
No. The AMX-X Crypt include is only a simple text XOR key character toggle.
__________________
Bugsy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode