From 05a9c4d8f328c1c9fab2748a05bc8fb6911edab1 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Tue, 2 Oct 2012 16:00:59 +0900 Subject: [PATCH] utils: a helper function to convert byte array into hex string Signed-off-by: Isaku Yamahata Signed-off-by: FUJITA Tomonori --- ryu/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ryu/utils.py b/ryu/utils.py index 1bc7ea3f..f2da6702 100644 --- a/ryu/utils.py +++ b/ryu/utils.py @@ -65,3 +65,7 @@ def find_flagfile(default_path=RYU_DEFAULT_FLAG_FILE): def round_up(x, y): return ((x + y - 1) / y) * y + + +def hex_array(data): + return ' '.join(hex(ord(chr)) for chr in data)