Added c++ version to code base.
This commit is contained in:
@@ -13,3 +13,6 @@ TestResults/
|
|||||||
*.tmp
|
*.tmp
|
||||||
*.bak
|
*.bak
|
||||||
*.b64.txt
|
*.b64.txt
|
||||||
|
BinaryConverter-source.zip
|
||||||
|
BinaryConverter-source.zip.certutil.txt
|
||||||
|
native/build/
|
||||||
|
|||||||
+19
-1
@@ -95,6 +95,11 @@ BinaryConverter/
|
|||||||
Program.cs
|
Program.cs
|
||||||
Properties/
|
Properties/
|
||||||
AssemblyInfo.cs
|
AssemblyInfo.cs
|
||||||
|
native/
|
||||||
|
Makefile
|
||||||
|
README.md
|
||||||
|
src/
|
||||||
|
binaryconverter.cpp
|
||||||
.editorconfig
|
.editorconfig
|
||||||
.gitattributes
|
.gitattributes
|
||||||
.gitignore
|
.gitignore
|
||||||
@@ -102,6 +107,19 @@ BinaryConverter/
|
|||||||
Readme.md
|
Readme.md
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Native Linux-Version
|
||||||
|
|
||||||
|
Unter `native/` liegt eine C++17-Implementierung fuer Linux. Sie erzeugt eine native Arch-Linux-Binary und verwendet OpenSSL/libcrypto fuer SHA-256. Das Transferformat ist identisch zur C#-Version, sodass Dateien auf Windows encoded und auf Linux decoded werden koennen oder umgekehrt.
|
||||||
|
|
||||||
|
Build:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd native
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
Die Binary liegt danach unter `native/build/binaryconverter`.
|
||||||
|
|
||||||
## Gitea-Hinweise
|
## Gitea-Hinweise
|
||||||
|
|
||||||
Das Repository enthaelt keine Build-Artefakte. `bin/`, `obj/`, Visual-Studio-Userdateien, Logs und temporaere Dateien sind ueber `.gitignore` ausgeschlossen.
|
Das Repository enthaelt keine Build-Artefakte. `bin/`, `obj/`, `native/build/`, Visual-Studio-Userdateien, Logs und temporaere Dateien sind ueber `.gitignore` ausgeschlossen.
|
||||||
|
|||||||
@@ -32,6 +32,25 @@ Die EXE liegt danach hier:
|
|||||||
BinaryConverter\bin\Release\BinaryConverter.exe
|
BinaryConverter\bin\Release\BinaryConverter.exe
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Native Linux-Version fuer Arch Linux:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd native
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
Die native Binary liegt danach hier:
|
||||||
|
|
||||||
|
```text
|
||||||
|
native/build/binaryconverter
|
||||||
|
```
|
||||||
|
|
||||||
|
Voraussetzungen unter Arch Linux:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo pacman -S --needed base-devel openssl pkgconf
|
||||||
|
```
|
||||||
|
|
||||||
## Nutzung
|
## Nutzung
|
||||||
|
|
||||||
Encode:
|
Encode:
|
||||||
@@ -46,6 +65,13 @@ Decode:
|
|||||||
BinaryConverter.exe -Decode Out.txt PowerShell.exe
|
BinaryConverter.exe -Decode Out.txt PowerShell.exe
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Unter Linux wird dieselbe Syntax mit der nativen Binary verwendet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./native/build/binaryconverter -Encode input.bin -Output Out.txt
|
||||||
|
./native/build/binaryconverter -Decode Out.txt output.bin
|
||||||
|
```
|
||||||
|
|
||||||
Alternative Decode-Syntax:
|
Alternative Decode-Syntax:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
CXX ?= g++
|
||||||
|
PKG_CONFIG ?= pkg-config
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
|
||||||
|
TARGET := binaryconverter
|
||||||
|
SRC := src/binaryconverter.cpp
|
||||||
|
BUILD_DIR := build
|
||||||
|
BIN := $(BUILD_DIR)/$(TARGET)
|
||||||
|
|
||||||
|
CXXFLAGS ?= -O3 -DNDEBUG -march=native
|
||||||
|
CPPFLAGS += -std=c++17 -Wall -Wextra -Wpedantic -D_FILE_OFFSET_BITS=64
|
||||||
|
LIBCRYPTO_CFLAGS := $(shell $(PKG_CONFIG) --cflags libcrypto 2>/dev/null)
|
||||||
|
LIBCRYPTO_LIBS := $(shell $(PKG_CONFIG) --libs libcrypto 2>/dev/null)
|
||||||
|
LDLIBS += $(if $(LIBCRYPTO_LIBS),$(LIBCRYPTO_LIBS),-lcrypto)
|
||||||
|
|
||||||
|
.PHONY: all clean install
|
||||||
|
|
||||||
|
all: $(BIN)
|
||||||
|
|
||||||
|
$(BIN): $(SRC)
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBCRYPTO_CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS)
|
||||||
|
|
||||||
|
install: $(BIN)
|
||||||
|
install -Dm755 $(BIN) "$(DESTDIR)$(PREFIX)/bin/$(TARGET)"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(BUILD_DIR)
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
# BinaryConverter Native fuer Linux
|
||||||
|
|
||||||
|
Diese Variante ist eine native C++17-Implementierung fuer Linux, getestet fuer Arch Linux. Sie ist formatkompatibel zur vorhandenen C#/.NET-Framework-Version: Encode-Dateien koennen zwischen Windows und Linux gegenseitig verarbeitet werden.
|
||||||
|
|
||||||
|
## Voraussetzungen
|
||||||
|
|
||||||
|
Arch Linux:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo pacman -S --needed base-devel openssl pkgconf
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd native
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
Die Binary liegt danach hier:
|
||||||
|
|
||||||
|
```text
|
||||||
|
native/build/binaryconverter
|
||||||
|
```
|
||||||
|
|
||||||
|
Optional generischere Binary ohne CPU-spezifische Optimierung:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make clean
|
||||||
|
make CXXFLAGS="-O3 -DNDEBUG"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Nutzung
|
||||||
|
|
||||||
|
Encode:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build/binaryconverter -Encode input.bin -Output transfer.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Decode:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build/binaryconverter -Decode transfer.txt output.bin
|
||||||
|
```
|
||||||
|
|
||||||
|
Mit Logfile:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build/binaryconverter -Encode input.bin -Output transfer.txt -Log binaryconverter.log
|
||||||
|
```
|
||||||
|
|
||||||
|
Vorhandene Ausgabedatei ueberschreiben:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build/binaryconverter -Decode transfer.txt output.bin -Force
|
||||||
|
```
|
||||||
|
|
||||||
|
## Verhalten
|
||||||
|
|
||||||
|
- Streaming-Verarbeitung ohne komplette Dateien in den RAM zu laden
|
||||||
|
- Base64-Zeilen mit 76 Zeichen
|
||||||
|
- temporaere Ausgabedatei im Zielverzeichnis und atomarer Rename nach Erfolg
|
||||||
|
- Decode prueft `SourceLength` und `SHA256`, wenn die Metadaten vorhanden sind
|
||||||
|
- Exitcodes wie die C#-Version: `0` Erfolg, `1` Laufzeit-/Datenfehler, `2` Argumentfehler
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user