move to codeberg (#1)

This commit is contained in:
T. von Dein
2025-12-01 20:42:23 +01:00
parent ef56d4eaa8
commit 865c545a02
6 changed files with 203 additions and 84 deletions

25
.woodpecker/build.yaml Normal file
View File

@@ -0,0 +1,25 @@
matrix:
platform:
- linux/amd64
labels:
platform: ${platform}
steps:
build:
when:
event: [push]
image: alpine:latest
commands:
- apk update
- apk add --no-cache bash build-base
- make
test:
when:
event: [push]
image: alpine:latest
commands:
- apk update
- apk add --no-cache bash
- echo hier | ./bubblebabble | grep xipak-nynil-dedox

49
Makefile Normal file
View File

@@ -0,0 +1,49 @@
#
# This file is part of bubblebabble.
#
# Copyright (C) 2018-2025 T.v.Dein.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# You can contact me by mail: <tom AT vondein DOT org>.
.PHONY: all clean man install
# warning: do not set -O to 2, see TODO
CFLAGS = -Wall -Wextra -Werror -O1 -g
LDFLAGS=
OBJS = main.o bubblebabble.o
DST = bubblebabble
PREFIX = /usr/local
UID = root
GID = 0
all: $(DST)
$(DST): $(OBJS)
$(CC) $(OBJS) -o $(DST)
%.o: %.c
$(CC) -c $(CFLAGS) $*.c -o $*.o
clean:
rm -rf *.o $(DST) build .cache
man:
pod2man udpxd.pod > udpxd.1
install: $(DST)
install -d -o $(UID) -g $(GID) $(PREFIX)/bin
install -o $(UID) -g $(GID) -m 555 $(DST) $(PREFIX)/bin/

View File

@@ -1,4 +1,5 @@
# bubblebabble
Encode to Bubble Babble
## Intro
@@ -10,8 +11,8 @@ function so you can encode anything to bubble babble.
## Compile and Install
gcc -g bubblebabble.c -o bubblebabble
sudo install -o root -g wheel bubblebabble /usr/local/bin/
make
sudo make install
## Usage
@@ -20,7 +21,7 @@ function so you can encode anything to bubble babble.
## Copyright + Author
- Copyright (c) 2017 T.v.Dein. All rights reserved.
- Copyright (c) 2017-2025 T.v.Dein. All rights reserved.
fingerprint_bubblebabble():

View File

@@ -30,13 +30,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include "bubblebabble.h"
static char *
fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len)
{
char *fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len) {
char vowels[] = {'a', 'e', 'i', 'o', 'u', 'y'};
char consonants[] = {'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
'n', 'p', 'r', 's', 't', 'v', 'z', 'x'};
@@ -50,11 +46,9 @@ fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len)
for (i = 0; i < rounds; i++) {
u_int idx0, idx1, idx2, idx3, idx4;
if ((i + 1 < rounds) || (dgst_raw_len % 2 != 0)) {
idx0 = (((((u_int)(dgst_raw[2 * i])) >> 6) & 3) +
seed) % 6;
idx0 = (((((u_int)(dgst_raw[2 * i])) >> 6) & 3) + seed) % 6;
idx1 = (((u_int)(dgst_raw[2 * i])) >> 2) & 15;
idx2 = ((((u_int)(dgst_raw[2 * i])) & 3) +
(seed / 6)) % 6;
idx2 = ((((u_int)(dgst_raw[2 * i])) & 3) + (seed / 6)) % 6;
retval[j++] = vowels[idx0];
retval[j++] = consonants[idx1];
retval[j++] = vowels[idx2];
@@ -64,9 +58,9 @@ fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len)
retval[j++] = consonants[idx3];
retval[j++] = '-';
retval[j++] = consonants[idx4];
seed = ((seed * 5) +
((((u_int)(dgst_raw[2 * i])) * 7) +
((u_int)(dgst_raw[(2 * i) + 1])))) % 36;
seed = ((seed * 5) + ((((u_int)(dgst_raw[2 * i])) * 7) +
((u_int)(dgst_raw[(2 * i) + 1])))) %
36;
}
} else {
idx0 = seed % 6;
@@ -81,38 +75,3 @@ fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len)
retval[j++] = '\0';
return retval;
}
int main(int argc, char **argv) {
FILE *input;
u_char digest[1024];
size_t digestlen;
char *hash;
int out = 1;
if(argc < 2) {
input = stdin;
}
else {
if((input = fopen(argv[1], "rb")) == NULL) {
fprintf(stderr, "oops, could not open file!\n");
goto done;
}
}
digestlen = fread(digest, 1, 1024, input);
if(digestlen > 0) {
hash = fingerprint_bubblebabble(digest, digestlen);
fprintf(stdout, "%s\n", hash);
free(hash);
out = 0;
}
else {
fprintf(stderr, "oops, could not calculate bubbles!\n");
goto done;
}
done:
return out;
}

31
bubblebabble.h Normal file
View File

@@ -0,0 +1,31 @@
/*
This file is part of bubblebabble.
Copyright (C) 2018-2025 T.v.Dein.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact me by mail: <tom AT vondein DOT org>.
*/
#ifndef HAVE_BUBABL
#define HAVE_BUBABL 1
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
char *fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len);
#endif

54
main.c Normal file
View File

@@ -0,0 +1,54 @@
/*
This file is part of bubblebabble.
Copyright (C) 2018-2025 T.v.Dein.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact me by mail: <tom AT vondein DOT org>.
*/
#include "bubblebabble.h"
int main(int argc, char **argv) {
FILE *input;
u_char digest[1024];
size_t digestlen;
char *hash;
int out = 1;
if (argc < 2) {
input = stdin;
} else {
if ((input = fopen(argv[1], "rb")) == NULL) {
fprintf(stderr, "oops, could not open file!\n");
goto done;
}
}
digestlen = fread(digest, 1, 1024, input);
if (digestlen > 0) {
hash = fingerprint_bubblebabble(digest, digestlen);
fprintf(stdout, "%s\n", hash);
free(hash);
out = 0;
} else {
fprintf(stderr, "oops, could not calculate bubbles!\n");
goto done;
}
done:
return out;
}