File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 SOFTWARE.
2323*/
2424
25- #include <stdio.h>
26- #include <string.h>
27-
2825#include "sha1/sha1.h"
2926#include "tabCon.h"
3027
3128void tabCon_generate (
3229 tabCon_t * tabCon ,
33- const char * string
30+ const char * string ,
31+ const int length
3432) {
3533 unsigned char x , y , i ;
3634
@@ -41,7 +39,7 @@ void tabCon_generate(
4139 SHA1Update (
4240 & context ,
4341 (const unsigned char * )string ,
44- strlen ( string )
42+ length
4543 );
4644 SHA1Final (tabCon -> hash , & context );
4745
@@ -67,12 +65,4 @@ void tabCon_generate(
6765 tabCon -> color [i - TABCON_PIXELS ] = tabCon -> hash [i ];
6866 }
6967 return ;
70- }
71-
72- void tabCon_printHash (const tabCon_t tabCon ) {
73- unsigned char i ;
74- for (i = 0 ; i < TABCON_LENGTH_HASH ; i ++ ) {
75- printf ("%02x" , tabCon .hash [i ]);
76- }
77- return ;
7868}
Original file line number Diff line number Diff line change @@ -40,9 +40,8 @@ typedef struct {
4040
4141void tabCon_generate (
4242 tabCon_t * tabCon ,
43- const char * string
43+ const char * string ,
44+ const int length
4445);
4546
46- void tabCon_printHash (const tabCon_t tabCon );
47-
4847#endif
Original file line number Diff line number Diff line change @@ -127,8 +127,10 @@ static inline char loadArgs(int argc, char *argv[]) {
127127}
128128
129129int main (int argc , char * argv []) {
130+ unsigned char i ;
131+
130132 printf (PROGRAM_NAME " v" PROGRAM_VERSION "\n" );
131- printf ("Created by StevenSYS\n" );
133+ printf ("Created by StevenSYS - 2025 \n" );
132134
133135 printf ("- Loading arguments\n" );
134136
@@ -144,11 +146,19 @@ int main(int argc, char *argv[]) {
144146
145147 printf ("- Generating TabCon\n" );
146148
147- tabCon_generate (& tabCon , hashString );
149+ tabCon_generate (
150+ & tabCon ,
151+ hashString ,
152+ strlen (hashString )
153+ );
148154
149155 printf ("- Generated TabCon\n" );
150156 printf ("- Hash: \"" );
151- tabCon_printHash (tabCon );
157+
158+ for (i = 0 ; i < TABCON_LENGTH_HASH ; i ++ ) {
159+ printf ("%02x" , tabCon .hash [i ]);
160+ }
161+
152162 printf ("\"\n" );
153163
154164 printf ("- Making PPM file\n" );
You can’t perform that action at this time.
0 commit comments