Permalink
Browse files

Merge branch 'dev', remote-tracking branch 'origin/dev'

  • Loading branch information...
2 parents a396de4 + 0fd308f commit 87d04fa2100979e743cea61a2207e11b0b0c6cdc @SanderDemeester committed Aug 13, 2012
Showing with 43 additions and 0 deletions.
  1. +15 −0 header/huge.h
  2. +28 −0 src/cryptografic_algoritmes/rsa/huge.c
View
@@ -19,3 +19,18 @@ void expaned(huge *huge1);
/* remove then and resize h appropriately */
/*******************************************************************/
void remove_unused_lsb(huge *h);
+
+/********************************************************/
+/* Multiply huge1, huge2 overwriting the value of huge1 */
+/********************************************************/
+void multiply(huge* huge1, huge* huge2);
+
+/**************************/
+/* copy int to byte array */
+/**************************/
+void set_huge(huge *h, unsigned int value);
+
+/*********************/
+/* copy huge to hyge */
+/*********************/
+void copy_huge(huge *target, huge *source);
@@ -85,3 +85,31 @@ static void substract(huge *huge1, huge *huge2){
}
remove_unused_lsb(huge1);
}
+/********************************************************/
+/* Multiply huge1, huge2 overwriting the value of huge1 */
+/********************************************************/
+void multiply(huge* huge1, huge* huge2){
+ unsigned char mask;
+ unsigned int i;
+ huge temp;
+
+ set_huge(&temp, 0);
+ copy_huge(&temp, huge1);
+
+ i = huge2->size;
+ do{
+ }while(i);
+
+}
+/*******************************************************************/
+/* remove unused bits in left most handside of the binary sequence */
+/*******************************************************************/
+remove_unused_lsb(huge* h){
+ int i = 0;
+ while(!(h->rep[i]) && (i < h->size)) i++;
+ if(i && i < h->size){
+ unsigned char *temp = &h->rep[i];
+ h->rep = (unsigned char*) calloc(h->size - i, sizeof(unsigned char));
+ memcpy(h->rep,temp, h->size-i);
+ }
+}

0 comments on commit 87d04fa

Please sign in to comment.