Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Pomfort committed May 23, 2016
1 parent 833a255 commit 93f449d
Show file tree
Hide file tree
Showing 254 changed files with 24,501 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .gitignore
@@ -0,0 +1,15 @@
# xcode noise
*.pbxuser
*.perspectivev3
*.mode1v3
*.xcuserdatad
*.xccheckout


# osx noise
.DS_Store
profile


bin
*.pyc
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 pomfort
Copyright (c) 2016 Pomfort GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
67 changes: 67 additions & 0 deletions README.md
@@ -0,0 +1,67 @@
#mhl-tool
The MHL tool is a reference implementation for creating and verifying MHL files (http://mediahashlist.org/). It's a cross-platform command line tool, available for Mac OS X, Linux and Windows that allows to create and verify MHL files.

#### Context

In the file-based workflows of digital cinematography today the secure and reliable transfer of media files is one of the essential activities to be performed in a production. The Media Hash List specification ensures that the complete source media is transferred without any alterations.

#### Inventory list for folders

The Media Hash List (MHL) standard specifies how a common inventory list of a folder's content looks like.

MHL is an XML format, that basically lists all the files in a folder and all of its subfolders as well as corresponding checksums. This list is accompanied by additional information about the creation of the MHL file.

Technically speaking, the MHL file comprehends all the information necessary to tell if the folder structure or any of the contained files was modified since the MHL file was created.

#### Reference implementation

This repository contains an implementation of the MHL standard (http://mediahashlist.org/mhl-specification/).

The MHL tool has currently several subcommands: 'seal', 'verify', 'hash', 'file' and 'help'. They vary in complexity and in their input and output arguments: 'files and folders', 'hashes' and 'MHL files'. Below is an illustration of the relations between subcommands and arguments.

##### mhl seal

This is the preferred command to seal the contents of folders. 'mhl seal' takes folders as input and outputs an MHL file. The created MHL file references all files in the input folder and generates hashes for them.

##### mhl verify

This is the preferred command to verify folders by MHL files. 'mhl verify' takes folders as input, searches for MHL files in them and outputs information about the consistency and completeness of the MHL files.

##### mhl hash

This is the command to create hashes from files and to verify if a hash matches a file. 'mhl hash' either takes files as input and outputs hashes for them or it takes pairs of hashes and files and outputs matching info.

##### mhl file

This is the command to create MHL files from pairs of hashes and files. Furthermore, it is the command to parse MHL files and output the contained pairs of hashes and files.


#### Installation and build

Precompiled binaries for OS X, Windows and Linux can be downloaded from http://pomfort.com/download

#### Dependencies
MHL Tool has very little dependencies. The source code for xxhash (https://github.com/Cyan4973/xxHash) is included in the repository.

#### Building on OS X

Use XCode 6.4 and the XCode workspace at `dev_envs/MacOSX_10.7/MHL_Tools.xcworkspace`

#### Building on Linux

The makefile is located at `dev_envs/Ubuntu_12.04_x64`

Dependencies: `libxml2-devel` `openssl-devel`

After calling `make release` the results will be placed in `bin/Ubuntu_12.04_x64/Release`

#### Building on Windows

It should be possible to build the sources on Windows using Visual Studio 2013 or 2010







Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

591 changes: 591 additions & 0 deletions dev_envs/MacOSX_10.7/mhlhash/mhlhash.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

200 changes: 200 additions & 0 deletions dev_envs/Ubuntu_12.04_x64/Makefile
@@ -0,0 +1,200 @@
CC := gcc
FLAGS := -Wall -D_GNU_SOURCE
LDFLAGS := -lcrypto -lxml2
TARGET_OS := Ubuntu_12.04_x64
PROG := mhl
SRC_DIR := ../../src
INCLUDE_DIRS := -I$(SRC_DIR)
CONFIGURE_COMMON_DIR := ../../src/facade_info

BUILD_TYPES := DEBUG RELEASE
DEBUG_CFLAGS := $(FLAGS) -ggdb -DDEBUG
RELEASE_CFLAGS := $(FLAGS) -O3
DEBUG_DIR := Debug
RELEASE_DIR := Release
DEBUG_CONFIG_NAME := debug
RELEASE_CONFIG_NAME := release

define VARS_DEF
$(1)_BIN_DIR := ../../bin/$(TARGET_OS)/$$($(1)_DIR)
$(1)_TARGET := $$($(1)_BIN_DIR)/$(PROG)
COMMON_$(1)_BUILD_DIR := build/$$($(1)_DIR)/common
TARGET_$(1)_BUILD_DIR := build/$$($(1)_DIR)/$(PROG)
endef

$(foreach BUILD_T,$(BUILD_TYPES),$(eval $(call VARS_DEF,$(BUILD_T))))

FACADE_INFO_SRC_DIR := $(SRC_DIR)/facade_info
FACADE_INFO_OBJS := error_codes.o
FACADE_INFO_INC_FILES := $(FACADE_INFO_SRC_DIR)/error_codes.h

GENERICS_OBJS := char_conversions.o \
std_funcs_os_anonymizer.o \
memory_management.o

GENERICS_SRC_DIR := $(SRC_DIR)/generics
GENERICS_INC_FILES := $(wildcard $(GENERICS_SRC_DIR)/*.h) $(FACADE_INFO_INC_FILES)

GENERICS_FILESYSTEM_OBJS := file_path_decomposition.o \
os_filepath_handlers.o \
os_filesystem_elements.o

GENERICS_FILESYSTEM_SRC_DIR := $(SRC_DIR)/generics/filesystem_handlers
GENERICS_FILESYSTEM_INC_FILES := $(wildcard $(GENERICS_FILESYSTEM_SRC_DIR)/*.h) $(GENERICS_INC_FILES)

MHLTOOLS_COMMON_OBJS := files_data.o \
usage_printing.o \
mhl_types.o \
logging.o \
hashing.o \
xxhash.o \
options.o

MHLTOOLS_COMMON_SRC_DIR := $(SRC_DIR)/mhltools_common
MHLTOOLS_COMMON_INC_FILES := $(wildcard $(MHLTOOLS_COMMON_SRC_DIR)/*.h) $(GENERICS_FILESYSTEM_INC_FILES)

THIRD_PARTY_SRC_DIR := $(SRC_DIR)/third_party

ARGS_SUPPORT_OBJS := file_sequences.o \
aux_funcs.o
ARGS_SUPPORT_SRC_DIR := $(SRC_DIR)/args_fileslist_support
ARGS_SUPPORT_FILES := $(wildcard $(ARGS_SUPPORT_SRC_DIR)/*.h) $(MHLTOOLS_COMMON_INC_FILES)

PARSEMHL_OBJS := mhl_file_handlers.o
PARSEMHL_SRC_DIR := $(SRC_DIR)/parsemhl
PARSEMHL_INC_DIRS := -I/usr/include/libxml2
PARSEMHL_INC_FILES := $(wildcard $(PARSEMHL_INC_SRC_DIR)/*.h) $(MHLTOOLS_COMMON_INC_FILES) $(THIRD_PARTY_SRC_DIR)/uthash.h

PRINTMHL_OBJS := print_mhl.o \
mhl_creator.o
PRINTMHL_SRC_DIR := $(SRC_DIR)/printmhl
PRINTMHL_INC_FILES := $(wildcard $(PRINTMHL_INC_SRC_DIR)/*.h) $(MHLTOOLS_COMMON_INC_FILES)

MHL_HELP_OBJS := help_topics.o \
mhl_help.o
MHL_HELP_SRC_DIR := $(SRC_DIR)/mhl_help
MHL_HELP_INC_FILES := $(wildcard $(MHL_HELP_SRC_DIR)/*.h) $(MHLTOOLS_COMMON_INC_FILES)

MHL_FILE_OBJS := input_parse_mode.o \
mhl_file_parse_mode.o \
mhl_file.o

MHL_FILE_SRC_DIR := $(SRC_DIR)/mhl_file
MHL_FILE_INC_FILES := $(sort $(wildcard $(MHL_FILE_SRC_DIR)/*.h) $(PARSEMHL_INC_FILES) $(PRINTMHL_INC_FILES) $(MHLTOOLS_COMMON_INC_FILES))

MHL_SEAL_OBJS := mhl_seal.o
MHL_SEAL_SRC_DIR := $(SRC_DIR)/mhl_seal
MHL_SEAL_INC_FILES := $(sort $(wildcard $(MHL_SEAL_SRC_DIR)/*.h) $(ARGS_SUPPORT_FILES) $(PRINTMHL_INC_FILES) $(MHLTOOLS_COMMON_INC_FILES))

MHL_HASH_OBJS := hash_calculate.o \
input_verify.o \
file_verify.o \
mhl_hash.o
MHL_HASH_SRC_DIR := $(SRC_DIR)/mhl_hash
MHL_HASH_INC_FILES := $(sort $(wildcard $(MHL_HASH_SRC_DIR)/*.h) $(ARGS_SUPPORT_FILES) $(MHLTOOLS_COMMON_INC_FILES))

MHL_VERIFICATION_OBJS := check_file.o \
mhlverify.o

MHL_VERIFICATION_SRC_DIR := $(SRC_DIR)/mhl_verify/mhl_verification
MHL_VERIFY_SRC_DIR := $(SRC_DIR)/mhl_verify

MHL_VERIFY_INC_FILES := $(sort $(wildcard $(MHL_VERIFICATION_SRC_DIR)/*.h) $(wildcard $(MHL_VERIFY_SRC_DIR)/*.h) $(ARGS_SUPPORT_FILES) $(MHLTOOLS_COMMON_INC_FILES))
MHL_VERIFICATION_INC_FILES := $(sort $(MHL_VERIFY_INC_FILES) $(PARSEMHL_INC_FILES))

MHL_VERIFY_OBJS := verify_options.o \
mhl_verify.o

MHL_OBJS := mhl.o
MHL_SRC_DIR := $(SRC_DIR)/mhl
MHL_INC_FILES := $(sort $(wildcard $(MHL_SRC_DIR)/*.h) $(MHL_HELP_INC_FILES) $(MHL_FILE_INC_FILES) $(MHL_SEAL_INC_FILES) $(MHL_HASH_INC_FILES) $(MHL_VERIFY_INC_FILES))

.DEFAULT: all
ifdef DEBUG
all $(PROG): $(DEBUG_CONFIG_NAME)
else
all $(PROG): $(RELEASE_CONFIG_NAME)
endif

#
# Let's split common and target-specific rules definition for better readability
# Trac manually dependencies from .h files until dependencies are not auto-calculated
#
SUBMODS_COMMON := FACADE_INFO GENERICS GENERICS_FILESYSTEM MHLTOOLS_COMMON

define COMMON_FILES_DEF
$(1)_DEBUG_FILES := $$(foreach obj_f,$$($(1)_OBJS),$(COMMON_DEBUG_BUILD_DIR)/$$(obj_f))
$(1)_RELEASE_FILES := $$(foreach obj_f,$$($(1)_OBJS),$(COMMON_RELEASE_BUILD_DIR)/$$(obj_f))

$$($(1)_RELEASE_FILES) $$($(1)_DEBUG_FILES):%.o: $$($(1)_SRC_DIR)/$$(@F:.o=.c) $$($(1)_INC_FILES)
@mkdir -p $$(COMMON_BUILD_DIR)
$$(CC) -c $$(CFLAGS) -o $$@ $(INCLUDE_DIRS) $$($(1)_SRC_DIR)/$$(@F:.o=.c)

COMMON_DEBUG_FILES += $$($(1)_DEBUG_FILES)
COMMON_RELEASE_FILES += $$($(1)_RELEASE_FILES)
endef

$(foreach SUBMOD,$(SUBMODS_COMMON),$(eval $(call COMMON_FILES_DEF,$(SUBMOD))))

SUBMODS_TARGET := ARGS_SUPPORT PRINTMHL PARSEMHL MHL_HELP MHL_FILE MHL_SEAL MHL_HASH MHL_VERIFICATION MHL_VERIFY MHL

define TARGET_FILES_DEF
$(1)_DEBUG_FILES := $$(foreach obj_f,$$($(1)_OBJS),$(TARGET_DEBUG_BUILD_DIR)/$$(obj_f))
$(1)_RELEASE_FILES := $$(foreach obj_f,$$($(1)_OBJS),$(TARGET_RELEASE_BUILD_DIR)/$$(obj_f))

$$($(1)_RELEASE_FILES) $$($(1)_DEBUG_FILES):%.o: $$($(1)_SRC_DIR)/$$(@F:.o=.c) $$($(1)_INC_FILES)
@mkdir -p $$(TARGET_BUILD_DIR)
$$(CC) -c $$(CFLAGS) -o $$@ $(INCLUDE_DIRS) $$($(2)) $$($(1)_SRC_DIR)/$$(@F:.o=.c)

TARGET_DEBUG_FILES += $$($(1)_DEBUG_FILES)
TARGET_RELEASE_FILES += $$($(1)_RELEASE_FILES)
endef

$(foreach SUBMOD,$(SUBMODS_TARGET),$(eval $(call TARGET_FILES_DEF,$(SUBMOD),$(SUBMOD)_INC_DIRS)))

#
# Define main targets and target-specific variables
#

define TARGET_DEF
$$($(1)_CONFIG_NAME): CFLAGS := $$($(1)_CFLAGS)

$$($(1)_CONFIG_NAME) $$($(1)_CONFIG_NAME)-clean: COMMON_BUILD_DIR := $$(COMMON_$(1)_BUILD_DIR)

$$($(1)_CONFIG_NAME) $$($(1)_CONFIG_NAME)-clean: TARGET_BUILD_DIR := $$(TARGET_$(1)_BUILD_DIR)

$$($(1)_CONFIG_NAME) $$($(1)_CONFIG_NAME)-clean: BIN_DIR := $$($(1)_BIN_DIR)
$$($(1)_CONFIG_NAME) $$($(1)_CONFIG_NAME)-clean: TARGET := $$($(1)_TARGET)


$$($(1)_CONFIG_NAME): configure $$($(1)_TARGET)

$$($(1)_TARGET): $$(COMMON_$(1)_FILES) $$(TARGET_$(1)_FILES)
@mkdir -p $$(BIN_DIR)
$(CC) $$(CFLAGS) -o $$@ $$(COMMON_$(1)_FILES) $$(TARGET_$(1)_FILES) $(LDFLAGS)
@echo ============== $(1) $(PROG) DONE ================
endef

$(foreach BUILD_T,$(BUILD_TYPES),$(eval $(call TARGET_DEF,$(BUILD_T))))

configure:
$(CONFIGURE_COMMON_DIR)/get_build_version.py

clean: $(RELEASE_CONFIG_NAME)-clean $(DEBUG_CONFIG_NAME)-clean

$(RELEASE_CONFIG_NAME)-clean $(DEBUG_CONFIG_NAME)-clean:
rm -f $(TARGET)
rm -rf $(COMMON_BUILD_DIR)
rm -rf $(TARGET_BUILD_DIR)

#
# phony targets
#

.PHONY: clean

.PHONY: release-clean

.PHONY: debug-clean

.PHONY: configure

0 comments on commit 93f449d

Please sign in to comment.