From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- Master/Public-Key-Algorithmen/PKA-Prakt1/.cproject | 607 +++++++++++++++++++++ Master/Public-Key-Algorithmen/PKA-Prakt1/.project | 81 +++ .../PKA-Prakt1/Debug/PKA-Prakt1 | Bin 0 -> 33441 bytes .../PKA-Prakt1/Debug/makefile | 44 ++ .../PKA-Prakt1/Debug/objects.mk | 7 + .../PKA-Prakt1/Debug/sources.mk | 17 + .../PKA-Prakt1/Debug/src/main.d | 1 + .../PKA-Prakt1/Debug/src/subdir.mk | 24 + .../Public-Key-Algorithmen/PKA-Prakt1/src/main.c | 88 +++ 9 files changed, 869 insertions(+) create mode 100644 Master/Public-Key-Algorithmen/PKA-Prakt1/.cproject create mode 100644 Master/Public-Key-Algorithmen/PKA-Prakt1/.project create mode 100755 Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/PKA-Prakt1 create mode 100644 Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/makefile create mode 100644 Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/objects.mk create mode 100644 Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/sources.mk create mode 100644 Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/src/main.d create mode 100644 Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/src/subdir.mk create mode 100644 Master/Public-Key-Algorithmen/PKA-Prakt1/src/main.c (limited to 'Master/Public-Key-Algorithmen/PKA-Prakt1') diff --git a/Master/Public-Key-Algorithmen/PKA-Prakt1/.cproject b/Master/Public-Key-Algorithmen/PKA-Prakt1/.cproject new file mode 100644 index 0000000..b7f74da --- /dev/null +++ b/Master/Public-Key-Algorithmen/PKA-Prakt1/.cproject @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Master/Public-Key-Algorithmen/PKA-Prakt1/.project b/Master/Public-Key-Algorithmen/PKA-Prakt1/.project new file mode 100644 index 0000000..0846f85 --- /dev/null +++ b/Master/Public-Key-Algorithmen/PKA-Prakt1/.project @@ -0,0 +1,81 @@ + + + PKA-Prakt1 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/PKA-Prakt1/Debug} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/PKA-Prakt1 b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/PKA-Prakt1 new file mode 100755 index 0000000..10f43c0 Binary files /dev/null and b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/PKA-Prakt1 differ diff --git a/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/makefile b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/makefile new file mode 100644 index 0000000..6832b8b --- /dev/null +++ b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/makefile @@ -0,0 +1,44 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +-include ../makefile.init + +RM := rm -rf + +# All of the sources participating in the build are defined here +-include sources.mk +-include subdir.mk +-include src/subdir.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +endif + +-include ../makefile.defs + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: PKA-Prakt1 + +# Tool invocations +PKA-Prakt1: $(OBJS) $(USER_OBJS) + @echo 'Building target: $@' + @echo 'Invoking: GCC C Linker' + gcc -o"PKA-Prakt1" $(OBJS) $(USER_OBJS) $(LIBS) + @echo 'Finished building target: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) PKA-Prakt1 + -@echo ' ' + +.PHONY: all clean dependents +.SECONDARY: + +-include ../makefile.targets diff --git a/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/objects.mk b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/objects.mk new file mode 100644 index 0000000..224ef68 --- /dev/null +++ b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/objects.mk @@ -0,0 +1,7 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := diff --git a/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/sources.mk b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/sources.mk new file mode 100644 index 0000000..57cf3c3 --- /dev/null +++ b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/sources.mk @@ -0,0 +1,17 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +O_SRCS := +C_SRCS := +S_UPPER_SRCS := +OBJ_SRCS := +ASM_SRCS := +OBJS := +C_DEPS := +EXECUTABLES := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +src \ + diff --git a/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/src/main.d b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/src/main.d new file mode 100644 index 0000000..d1c377e --- /dev/null +++ b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/src/main.d @@ -0,0 +1 @@ +src/main.d src/main.o: ../src/main.c diff --git a/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/src/subdir.mk b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/src/subdir.mk new file mode 100644 index 0000000..3a430c3 --- /dev/null +++ b/Master/Public-Key-Algorithmen/PKA-Prakt1/Debug/src/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../src/main.c + +OBJS += \ +./src/main.o + +C_DEPS += \ +./src/main.d + + +# Each subdirectory must supply rules for building sources it contributes +src/%.o: ../src/%.c + @echo 'Building file: $<' + @echo 'Invoking: GCC C Compiler' + gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Master/Public-Key-Algorithmen/PKA-Prakt1/src/main.c b/Master/Public-Key-Algorithmen/PKA-Prakt1/src/main.c new file mode 100644 index 0000000..2987966 --- /dev/null +++ b/Master/Public-Key-Algorithmen/PKA-Prakt1/src/main.c @@ -0,0 +1,88 @@ +/* + * main.c + * + * Created on: 23.04.2010 + * Author: sven + */ +#include +#include +#include +#include +#include + +#define HI(x) (x >> 16) +#define LO(x) (x & 0x0000FFFF) + +void mulc(uint32_t *u, uint32_t *v, uint32_t a, uint32_t b) +{ + uint32_t t; + t = LO(a) * LO(b); + *v = LO(t); + t = HI(t) + HI(a) * LO(b); + *u = HI(t); + t = LO(t) + LO(a) * HI(b); + *v |= LO(t) << 16; + *u += HI(t) + HI(a) * HI(b); +} +void mula(uint32_t *u, uint32_t *v, uint32_t a, uint32_t b) +{ + asm + ( + "mov %2,%%eax\n" + "mul %3\n" + "mov %%edx, %0\n" + "mov %%eax, %1" + :"=r"(*u),"=r"(*v) + :"r"(a),"r"(b) + ); +} +void initRandomizer() +{ + srand(time(NULL)); +} +uint32_t getRandomUint32() +{ + uint32_t res = rand(); + if(res % 2) + { + return (res | 1<<31); + } + return res; +} +int main(int argc, char* argv[]) +{ + initRandomizer(); + uint32_t a = getRandomUint32(); + uint32_t b = getRandomUint32(); + uint32_t u,v; + uint32_t counter; + uint32_t outerCnt; + const uint32_t NUM_INNER_LOOPS = 1000000; + const uint32_t NUM_OUTER_LOOPS = 1000; + struct timeval startc; + struct timeval endc; + struct timeval starta; + struct timeval enda; + long diffCsum = 0,diffAsum = 0; + for(outerCnt=0;outerCnt