6 * Portable ISO 'C' (1994) runtime library for the Amiga computer
7 * Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * - Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * - Neither the name of Olaf Barthel nor the names of contributors
18 * may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
34 #define ACrypt __ACrypt
36 #include <exec/types.h>
38 #include <clib/alib_protos.h>
42 /****************************************************************************/
45 #include <aros/debug.h>
47 /****************************************************************************/
51 /****************************************************************************/
53 UBYTE
* ACrypt(UBYTE
* buffer
, const UBYTE
* password
, const UBYTE
* user
);
55 /****************************************************************************/
58 ACrypt(UBYTE
* buffer
, const UBYTE
* password
, const UBYTE
* user
)
60 UBYTE
* result
= NULL
;
67 //assert( buffer != NULL && password != NULL && user != NULL );
69 //SHOWPOINTER(buffer);
70 //SHOWSTRING(password);
72 D(bug("[ACrypt] buffer %p password %s user %s\n", buffer
, password
, user
));
74 if(buffer
== NULL
|| password
== NULL
|| user
== NULL
)
76 //SHOWMSG("invalid parameters");
77 D(bug("[ACrypt] invalid parameters\n"));
81 for(i
= 0 ; i
< OSIZE
; i
++)
83 if((*password
) != '\0')
96 for(i
= 0 ; i
< OSIZE
; i
++)
98 for(k
= 0 ; k
< OSIZE
; k
++)
99 buf
[i
] = (buf
[i
] + buf
[OSIZE
- k
- 1]) % 53;
101 buffer
[i
] = buf
[i
] + 'A';
104 buffer
[OSIZE
-1] = '\0';
106 //SHOWSTRING(buffer);
107 D(bug("[ACrypt] buffer %s\n", buffer
));
114 D(bug("[ACrypt] return value %s\n", result
));